2025-01-08 22:34:47 +00:00
|
|
|
{
|
|
|
|
pkgs ? import <nixpkgs> { },
|
|
|
|
}:
|
2024-11-26 01:27:27 +00:00
|
|
|
|
2024-11-26 16:53:29 +00:00
|
|
|
let
|
|
|
|
# Input source files
|
2024-11-26 01:27:27 +00:00
|
|
|
src = ./.;
|
2024-11-26 16:53:29 +00:00
|
|
|
nodeDeps = import ./node-deps.nix { inherit pkgs; };
|
|
|
|
inherit (nodeDeps) packageJSON nodeModules;
|
|
|
|
in
|
|
|
|
pkgs.stdenv.mkDerivation {
|
|
|
|
name = "veganprestwich-co-uk";
|
2024-11-26 01:27:27 +00:00
|
|
|
|
2025-01-08 22:34:47 +00:00
|
|
|
src = builtins.filterSource (
|
|
|
|
path: type:
|
|
|
|
!(builtins.elem (baseNameOf path) [
|
2024-11-26 16:53:29 +00:00
|
|
|
"_site"
|
|
|
|
"node_modules"
|
|
|
|
".git"
|
2025-01-08 22:34:47 +00:00
|
|
|
])
|
|
|
|
) src;
|
2024-11-26 16:53:29 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
|
|
cacert
|
2024-11-27 09:17:45 +00:00
|
|
|
lightningcss
|
|
|
|
sass
|
|
|
|
yarn
|
2024-11-26 01:27:27 +00:00
|
|
|
];
|
|
|
|
|
2024-11-26 16:53:29 +00:00
|
|
|
configurePhase = ''
|
|
|
|
export HOME=$TMPDIR
|
2024-11-26 01:27:27 +00:00
|
|
|
mkdir -p _site/style
|
|
|
|
|
2024-11-26 16:53:29 +00:00
|
|
|
cp -r ${nodeModules}/node_modules .
|
|
|
|
chmod -R +w node_modules
|
|
|
|
cp ${packageJSON} package.json
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
2025-01-08 22:34:47 +00:00
|
|
|
echo 'Building CSS'
|
2025-01-08 22:41:30 +00:00
|
|
|
sass --update style:_site/style --style compressed
|
2024-11-26 01:27:27 +00:00
|
|
|
|
2024-11-26 16:53:29 +00:00
|
|
|
echo 'Building site'
|
2024-11-27 09:17:45 +00:00
|
|
|
yarn --offline eleventy
|
2024-11-26 01:27:27 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r _site/* $out/
|
2024-11-26 16:53:29 +00:00
|
|
|
rm -rf node_modules _site package.json
|
2024-11-26 01:27:27 +00:00
|
|
|
'';
|
|
|
|
}
|