Compare commits
No commits in common. "cd187e3092dce488d7f9817109e54b239e311952" and "b6ee55af9ff971d88f38149656574165010d51d2" have entirely different histories.
cd187e3092
...
b6ee55af9f
18
.gitignore
vendored
18
.gitignore
vendored
@ -1,11 +1,13 @@
|
||||
# Nix build output
|
||||
/result
|
||||
|
||||
# development
|
||||
/.direnv/
|
||||
/themes
|
||||
|
||||
# Generated files by hugo
|
||||
/public/
|
||||
/resources/
|
||||
/resources/_gen/
|
||||
/assets/jsconfig.json
|
||||
hugo_stats.json
|
||||
|
||||
# Temporary lock file while building
|
||||
/.hugo_build.lock
|
||||
|
||||
# Nix
|
||||
.direnv/
|
||||
/result
|
||||
/themes/
|
42
flake.lock
42
flake.lock
@ -1,17 +1,35 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689068808,
|
||||
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1709237383,
|
||||
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
|
||||
"lastModified": 1692207601,
|
||||
"narHash": "sha256-tfPGNKQcJT1cvT6ufqO/7ydYNL6mcJClvzbrzhKjB80=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
|
||||
"rev": "b30c68669df77d981ce4aefd6b9d378563f6fc4e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
@ -34,9 +52,25 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nostyleplease": "nostyleplease"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
55
flake.nix
55
flake.nix
@ -2,7 +2,8 @@
|
||||
description = "Kristian's Website";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nostyleplease = {
|
||||
url = "github:Masellum/hugo-theme-nostyleplease";
|
||||
flake = false;
|
||||
@ -12,57 +13,49 @@
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
nostyleplease,
|
||||
}: let
|
||||
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system});
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
formatter = forAllSystems (system: pkgs.${system}.alejandra);
|
||||
formatter = pkgs.alejandra;
|
||||
|
||||
packages = forAllSystems (system: {
|
||||
default = pkgs.${system}.stdenv.mkDerivation {
|
||||
packages.default = pkgs.stdenv.mkDerivation {
|
||||
name = "blog";
|
||||
|
||||
# Exclude themes and public folder from build sources
|
||||
src = builtins.filterSource (path: type: !(type == "directory" && (baseNameOf path == "themes" || baseNameOf path == "public"))) ./.;
|
||||
meta = with pkgs.lib; {
|
||||
description = "Kristian's personal blog";
|
||||
platforms = platforms.all;
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs.${system}; [
|
||||
hugo
|
||||
];
|
||||
# Exclude themes and public folder from build sources
|
||||
src = builtins.filterSource (path: type:
|
||||
!(type
|
||||
== "directory"
|
||||
&& (baseNameOf path == "themes" || baseNameOf path == "public")))
|
||||
./.;
|
||||
|
||||
# Link theme to themes folder and build
|
||||
buildPhase = ''
|
||||
mkdir -p themes
|
||||
ln -s ${nostyleplease} themes/nostyleplease
|
||||
hugo --gc --minify
|
||||
${pkgs.hugo}/bin/hugo --gc --minify
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -r public/. $out
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system: {
|
||||
default = pkgs.${system}.mkShellNoCC {
|
||||
packages = with pkgs.${system}; [
|
||||
hugo
|
||||
];
|
||||
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [hugo];
|
||||
# Link theme to themes folder
|
||||
shellHook = ''
|
||||
if [ ! -d ./themes ]; then
|
||||
mkdir ./themes
|
||||
fi
|
||||
|
||||
if [ ! -d ./themes/nostyleplease ]; then
|
||||
ln -s ${nostyleplease} ./themes/nostyleplease
|
||||
fi
|
||||
|
||||
hugo server --buildDrafts
|
||||
mkdir -p themes
|
||||
unlink themes/nostyleplease
|
||||
ln -s ${nostyleplease} themes/nostyleplease
|
||||
'';
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user