summaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix')
-rw-r--r--nix/package.nix53
1 files changed, 53 insertions, 0 deletions
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