nix: make dist tarball in nix
All checks were successful
Static / Flake checks (push) Successful in 29s
Static / Create distribution (push) Successful in 55s

This is more sound than having to rely on host nix shell.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-03-15 17:46:36 +09:00
parent 53cc6e642c
commit baa6520b90
4 changed files with 24 additions and 13 deletions

View File

@@ -67,17 +67,25 @@
packages = forAllSystems (
system:
let
inherit (self.packages.${system}) hakurei-static caddy-hakurei-static;
inherit (self.packages.${system}) static caddy;
pkgs = nixpkgsFor.${system};
in
{
default = caddy-hakurei-static;
hakurei-static = pkgs.callPackage ./package.nix { };
caddy-hakurei-static = pkgs.writeShellScriptBin "caddy-hakurei-static" ''
default = caddy;
static = pkgs.callPackage ./package.nix { };
dist = pkgs.runCommand "hakurei-static-${static.version}.tar.zst" { } ''
PATH="${pkgs.zstd}/bin:$PATH" \
${pkgs.gnutar}/bin/tar \
-C '${static}' \
--zstd \
-cf \
"$out" .
'';
caddy = pkgs.writeShellScriptBin "caddy-hakurei-static" ''
exec ${pkgs.caddy}/bin/caddy \
file-server \
-a -l ":49151" \
-r ${hakurei-static}
-r ${static}
'';
}
);