79 lines
1.8 KiB
Nix
79 lines
1.8 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:AgathaSorceress/nixpkgs/image-optim-pack-cleanup";
|
|
utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, utils }:
|
|
utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfree = true;
|
|
};
|
|
lib = pkgs.lib;
|
|
jekyll_env = pkgs.bundlerEnv {
|
|
name = "jekyll_env";
|
|
inherit (pkgs) ruby;
|
|
|
|
gemdir = ./.;
|
|
};
|
|
deps = with pkgs; [
|
|
jekyll_env
|
|
# nokogiri dependencies
|
|
zlib
|
|
libiconv
|
|
libxml2
|
|
libxslt
|
|
# jekyll wants a JS runtime
|
|
nodejs-slim
|
|
];
|
|
image_optim_deps = with pkgs; [
|
|
pngout
|
|
advancecomp
|
|
optipng
|
|
pngquant
|
|
jhead
|
|
jpegoptim
|
|
jpeg-archive
|
|
libjpeg
|
|
];
|
|
path = ''
|
|
PATH="${
|
|
lib.escapeShellArg (lib.makeBinPath image_optim_deps)
|
|
}":$PATH'';
|
|
in {
|
|
packages.default = pkgs.stdenv.mkDerivation {
|
|
name = "vampysite";
|
|
src = ./.;
|
|
|
|
buildInputs = deps;
|
|
|
|
buildPhase = ''
|
|
export ${path}
|
|
|
|
bundle exec jekyll build
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out
|
|
cp -r _site/* $out/
|
|
'';
|
|
|
|
};
|
|
devShells = with pkgs; {
|
|
default = mkShell {
|
|
buildInputs = deps;
|
|
shellHook = "export ${path}";
|
|
};
|
|
run = mkShell {
|
|
buildInputs = deps;
|
|
shellHook = ''
|
|
export ${path}
|
|
exec bundle exec jekyll serve --livereload
|
|
'';
|
|
};
|
|
};
|
|
});
|
|
}
|