1
0
Fork 0
forked from pim/blog
blog/flake.nix

60 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2024-04-26 10:59:32 +02:00
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
2024-04-26 11:48:32 +02:00
flutils.url = "github:numtide/flake-utils";
2024-04-26 10:59:32 +02:00
};
outputs = {
nixpkgs,
flutils,
...
}:
flutils.lib.eachDefaultSystem (system: let
2024-04-26 11:48:32 +02:00
pkgs = nixpkgs.legacyPackages.${system};
2024-04-26 10:59:32 +02:00
2024-04-26 11:48:32 +02:00
gems = pkgs.bundlerEnv {
2024-12-29 22:49:54 +01:00
name = "blog";
2024-04-26 11:48:32 +02:00
gemdir = ./src;
};
2024-04-26 10:59:32 +02:00
2024-04-26 11:48:32 +02:00
patch-feed-date = pkgs.stdenv.mkDerivation {
name = "path-feed-date";
propagatedBuildInputs = [pkgs.python3];
2024-04-26 11:48:32 +02:00
dontUnpack = true;
installPhase = "install -Dm755 ${./patch-feed-date.py} $out/bin/patch-feed-date";
};
buildInputs = [
gems
gems.wrappedRuby
patch-feed-date
];
in {
packages = rec {
default = static-website;
static-website = pkgs.stdenv.mkDerivation {
2024-12-29 22:49:54 +01:00
name = "blog";
src = ./src;
sourceRoot = "src";
inherit buildInputs;
buildPhase = ''
bundle exec jekyll build --future
'';
installPhase = ''
mkdir -p $out
cp -r _site/* $out/
patch-feed-date --file _site/feed.xml > $out/feed.xml
'';
};
2024-04-26 11:48:32 +02:00
};
devShells.default = pkgs.mkShell {
inherit buildInputs;
};
2024-04-26 11:48:32 +02:00
});
2024-04-26 10:59:32 +02:00
}