2024-12-15 00:15:14 +00:00
|
|
|
{
|
|
|
|
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:
|
2024-12-15 20:13:13 +00:00
|
|
|
let
|
|
|
|
nodeDependencies = (pkgs.callPackage ./node.nix { }).nodeDependencies;
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
buildInputs = with pkgs; [ hugo nodejs nodeDependencies ];
|
2024-12-15 00:15:14 +00:00
|
|
|
in with pkgs; {
|
2024-12-15 20:13:13 +00:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
2024-12-15 00:15:14 +00:00
|
|
|
});
|
|
|
|
}
|