pages/flake.nix

39 lines
1.2 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
nodeDependencies = (pkgs.callPackage ./node.nix { }).nodeDependencies;
pkgs = import nixpkgs { inherit system; };
buildInputs = with pkgs; [ hugo nodejs nodeDependencies ];
in with pkgs; {
devShells.default = mkShell { inherit buildInputs; };
packages.default = stdenvNoCC.mkDerivation {
name = "millironx-pages";
src = self;
inherit buildInputs;
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
buildPhase = ''
runHook preBuild
ln -s ${nodeDependencies}/lib/node_modules ./node_modules
export PATH="${nodeDependencies}/bin:$PATH"
HUGO_ENV=production HUGO_ENVIRONMENT=production hugo --minify
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r public/* $out/
runHook postInstall
'';
};
});
}