2023-08-17 14:16:17 +00:00
|
|
|
{
|
2023-08-17 19:50:16 +00:00
|
|
|
description = "Kristian's Website";
|
2023-08-17 14:16:17 +00:00
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
nostyleplease = {
|
|
|
|
url = "github:Masellum/hugo-theme-nostyleplease";
|
|
|
|
flake = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
flake-utils,
|
|
|
|
nostyleplease,
|
|
|
|
}:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system: let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in {
|
2023-08-17 23:02:41 +00:00
|
|
|
formatter = pkgs.alejandra;
|
|
|
|
|
2023-08-17 14:16:17 +00:00
|
|
|
packages.default = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "blog";
|
|
|
|
|
|
|
|
meta = with pkgs.lib; {
|
|
|
|
description = "Kristian's personal blog";
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
|
|
|
|
# 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
|
2023-08-17 15:07:46 +00:00
|
|
|
${pkgs.hugo}/bin/hugo --gc --minify
|
2023-08-17 14:16:17 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2023-08-17 16:55:29 +00:00
|
|
|
cp -r public/. $out
|
2023-08-17 14:16:17 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
devShells.default = pkgs.mkShellNoCC {
|
2023-08-17 20:50:29 +00:00
|
|
|
packages = with pkgs; [hugo];
|
2023-08-17 14:16:17 +00:00
|
|
|
# Link theme to themes folder
|
|
|
|
shellHook = ''
|
|
|
|
mkdir -p themes
|
2023-08-17 15:07:46 +00:00
|
|
|
unlink themes/nostyleplease
|
|
|
|
ln -s ${nostyleplease} themes/nostyleplease
|
2023-08-17 14:16:17 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|