blog-pim/flake.nix
2024-04-26 15:12:23 +02:00

48 lines
1.1 KiB
Nix

{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flutils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flutils }: flutils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
gems = pkgs.bundlerEnv {
name = "blog-pim";
gemdir = ./src;
};
patch-feed-date = pkgs.stdenv.mkDerivation {
name = "path-feed-date";
propagatedBuildInputs = [ pkgs.python3 ];
dontUnpack = true;
installPhase = "install -Dm755 ${./patch-feed-date.py} $out/bin/patch-feed-date";
};
in
{
packages.static-website = pkgs.stdenv.mkDerivation {
name = "blog-pim";
src = ./src;
sourceRoot = "src";
buildInputs = [
gems
gems.wrappedRuby
patch-feed-date
];
buildPhase = ''
bundle exec jekyll build
'';
installPhase = ''
mkdir -p $out
cp -r _site/* $out/
patch-feed-date --file _site/feed.xml > $out/feed.xml
'';
};
});
}