From bd46bfd1728b513a09193e916c73acae37a7b846 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 23 Aug 2024 08:44:19 -0400 Subject: nix: simplify flake --- nix/package.nix | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 nix/package.nix (limited to 'nix/package.nix') diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..63f4290 --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,53 @@ +{ + lib, + stdenvNoCC, + writeShellApplication, + miniserve, + zola, + + nix-filter, + self, +}: + +let + website = stdenvNoCC.mkDerivation { + pname = "getchoo-website"; + version = builtins.substring 0 8 self.lastModifiedDate or "dirty"; + + src = nix-filter.lib { + root = self; + include = [ + "config.toml" + "content" + "static" + "templates" + ]; + }; + + nativeBuildInputs = [ zola ]; + + dontConfigure = true; + dontFixup = true; + + buildPhase = "zola build"; + installPhase = "mv public $out"; + + passthru = { + serve = writeShellApplication { + name = "serve"; + runtimeInputs = [ miniserve ]; + + text = '' + miniserve ${website}/ + ''; + }; + }; + + meta = { + homepage = "https://github.com/getchoo/website"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ getchoo ]; + }; + }; +in +website -- cgit v1.2.3