twopn/flake.nix
2026-01-24 19:48:10 -05:00

58 lines
1.4 KiB
Nix

{
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
self-pkgs = self.packages.${system};
default-flags = ["--formats=mdx" "--input=site-src"];
eleventy-shortcut = { name, args ? [] }: pkgs.writeShellApplication {
inherit name;
text = ''
npx @11ty/eleventy \
${pkgs.lib.escapeShellArgs default-flags} \
${pkgs.lib.escapeShellArgs args} \
"$@"
'';
runtimeInputs = [
pkgs.nodejs_25
];
};
deploy = pkgs.writeShellApplication {
name = "deploy";
text = ''
build
rsyncy --archive _site/* mbk@celestia:/srv/twopn
'';
runtimeInputs = [
self-pkgs.build
pkgs.rsyncy
];
};
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_25
];
};
packages = {
default = eleventy-shortcut { name = "eleventy"; };
build = eleventy-shortcut { name = "build"; };
serve = eleventy-shortcut { name = "serve"; args = ["--serve"]; };
watch = eleventy-shortcut { name = "watch"; args = ["--watch"]; };
inherit deploy;
};
}
);
}