Teach flake.nix to build website

This commit is contained in:
Jez Cope 2021-09-10 21:18:27 +01:00
parent 1ef1c82b87
commit a7be6d1b37
3 changed files with 23 additions and 22 deletions

View File

@ -11,3 +11,4 @@ deploy.yaml
resources
.direnv
.envrc
result

View File

@ -5,11 +5,26 @@
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShell = import ./shell.nix { inherit pkgs; };
}
);
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
defaultPackage = pkgs.stdenv.mkDerivation {
name = "erambler-html";
src = ./.;
nativeBuildInputs = [ pkgs.hugo ];
buildPhase = "hugo";
installPhase = ''
mkdir $out
cp -R public/* $out
'';
};
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
(python38.withPackages
(py: with py; [ python invoke rich requests ruamel_yaml sh ]))
yarn
hugo
];
};
});
}

View File

@ -1,15 +0,0 @@
{ pkgs, ... }:
let
python = pkgs.python38;
pythonWithPackages = python.withPackages (py: [
py.python
# For locally-run tasks
py.invoke
py.rich
py.requests
py.ruamel_yaml
py.sh
]);
in pkgs.mkShell { buildInputs = with pkgs; [ pythonWithPackages yarn hugo ]; }