Compare commits

..

No commits in common. "cd187e3092dce488d7f9817109e54b239e311952" and "b6ee55af9ff971d88f38149656574165010d51d2" have entirely different histories.

3 changed files with 73 additions and 44 deletions

18
.gitignore vendored
View File

@ -1,11 +1,13 @@
# Nix build output
/result
# development
/.direnv/
/themes
# Generated files by hugo # Generated files by hugo
/public/ /public/
/resources/ /resources/_gen/
/assets/jsconfig.json
hugo_stats.json
# Temporary lock file while building
/.hugo_build.lock /.hugo_build.lock
# Nix
.direnv/
/result
/themes/

View File

@ -1,17 +1,35 @@
{ {
"nodes": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1709237383, "lastModified": 1692207601,
"narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", "narHash": "sha256-tfPGNKQcJT1cvT6ufqO/7ydYNL6mcJClvzbrzhKjB80=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", "rev": "b30c68669df77d981ce4aefd6b9d378563f6fc4e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-23.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -34,9 +52,25 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nostyleplease": "nostyleplease" "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", "root": "root",

View File

@ -2,7 +2,8 @@
description = "Kristian's Website"; description = "Kristian's Website";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
nostyleplease = { nostyleplease = {
url = "github:Masellum/hugo-theme-nostyleplease"; url = "github:Masellum/hugo-theme-nostyleplease";
flake = false; flake = false;
@ -12,57 +13,49 @@
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
flake-utils,
nostyleplease, nostyleplease,
}: let }:
supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; flake-utils.lib.eachDefaultSystem (system: let
forAllSystems = nixpkgs.lib.genAttrs supportedSystems; pkgs = nixpkgs.legacyPackages.${system};
pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); in {
in { formatter = pkgs.alejandra;
formatter = forAllSystems (system: pkgs.${system}.alejandra);
packages = forAllSystems (system: { packages.default = pkgs.stdenv.mkDerivation {
default = pkgs.${system}.stdenv.mkDerivation {
name = "blog"; name = "blog";
# Exclude themes and public folder from build sources meta = with pkgs.lib; {
src = builtins.filterSource (path: type: !(type == "directory" && (baseNameOf path == "themes" || baseNameOf path == "public"))) ./.; description = "Kristian's personal blog";
platforms = platforms.all;
};
nativeBuildInputs = with pkgs.${system}; [ # Exclude themes and public folder from build sources
hugo src = builtins.filterSource (path: type:
]; !(type
== "directory"
&& (baseNameOf path == "themes" || baseNameOf path == "public")))
./.;
# Link theme to themes folder and build # Link theme to themes folder and build
buildPhase = '' buildPhase = ''
mkdir -p themes mkdir -p themes
ln -s ${nostyleplease} themes/nostyleplease ln -s ${nostyleplease} themes/nostyleplease
hugo --gc --minify ${pkgs.hugo}/bin/hugo --gc --minify
''; '';
installPhase = '' installPhase = ''
cp -r public/. $out 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 # Link theme to themes folder
shellHook = '' shellHook = ''
if [ ! -d ./themes ]; then mkdir -p themes
mkdir ./themes unlink themes/nostyleplease
fi ln -s ${nostyleplease} themes/nostyleplease
if [ ! -d ./themes/nostyleplease ]; then
ln -s ${nostyleplease} ./themes/nostyleplease
fi
hugo server --buildDrafts
''; '';
}; };
}); });
};
} }