about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules2
-rw-r--r--Makefile34
-rw-r--r--flake.nix28
4 files changed, 40 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index fed311c..c510874 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /public/
 
 .direnv
+/result
diff --git a/.gitmodules b/.gitmodules
index 5925756..b7aeba2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
 [submodule "themes/bear"]
 	path = themes/bear
-	url = ssh://codeberg.org/alanpearce/zola-bearblog
+	url = ssh://git.alanpearce.eu/zola-bearblog
diff --git a/Makefile b/Makefile
index bfd849e..8a23811 100644
--- a/Makefile
+++ b/Makefile
@@ -2,57 +2,61 @@
 .ONESHELL:
 .DELETE_ON_ERROR:
 
+PREFIX ?= public
+
 brotli := brotli --force
 gzip := gzip --best --keep --force
 zstd := zstd --force --no-pass-through -19 --quiet
 
 build:
-	zola build
+	zola build --output-dir $(PREFIX)
 
-to_compress := $(shell fd . public --type=file -e html -e xml -e txt -e asc)
+to_compress := $(shell fd . $(PREFIX) --type=file -e html -e xml -e txt -e asc)
 brotli_files := $(patsubst %, %.br, $(to_compress))
 gzip_files := $(patsubst %, %.gz, $(to_compress))
 zstd_files := $(patsubst %, %.zst, $(to_compress))
 
-public/%.html.br: public/%.html
+${PREFIX}/%.html.br: ${PREFIX}/%.html
 	$(brotli) $<
 
-public/%.xml.br: public/%.xml
+${PREFIX}/%.xml.br: ${PREFIX}/%.xml
 	$(brotli) $<
 
-public/%.txt.br: public/%.txt
+${PREFIX}/%.txt.br: ${PREFIX}/%.txt
 	$(brotli) $<
 
-public/%.asc.br: public/%.asc
+${PREFIX}/%.asc.br: ${PREFIX}/%.asc
 	$(brotli) $<
 
-public/%.html.gz: public/%.html
+${PREFIX}/%.html.gz: ${PREFIX}/%.html
 	$(gzip) $<
 
-public/%.xml.gz: public/%.xml
+${PREFIX}/%.xml.gz: ${PREFIX}/%.xml
 	$(gzip) $<
 
-public/%.txt.gz: public/%.txt
+${PREFIX}/%.txt.gz: ${PREFIX}/%.txt
 	$(gzip) $<
 
-public/%.asc.gz: public/%.asc
+${PREFIX}/%.asc.gz: ${PREFIX}/%.asc
 	$(gzip) $<
 
-public/%.html.zst: public/%.html
+${PREFIX}/%.html.zst: ${PREFIX}/%.html
 	$(zstd) $<
 
-public/%.xml.zst: public/%.xml
+${PREFIX}/%.xml.zst: ${PREFIX}/%.xml
 	$(zstd) $<
 
-public/%.txt.zst: public/%.txt
+${PREFIX}/%.txt.zst: ${PREFIX}/%.txt
 	$(zstd) $<
 
-public/%.asc.zst: public/%.asc
+${PREFIX}/%.asc.zst: ${PREFIX}/%.asc
 	$(zstd) $<
 
 compress: $(brotli_files) $(gzip_files) $(zstd_files)
 
+install: compress
+
 deploy: build compress
 	rsync --archive --delete public/ pappel.alanpearce.eu:/srv/http/alanpearce.eu
 
-.PHONY: all build compress deploy
+.PHONY: all build compress install deploy
diff --git a/flake.nix b/flake.nix
index 7403f7e..6625f73 100644
--- a/flake.nix
+++ b/flake.nix
@@ -9,15 +9,25 @@
         pkgs = nixpkgs.legacyPackages.${system};
       in
       {
-        devShells.default = pkgs.mkShell {
-          packages = with pkgs; [
-            brotli
-            gzip
-            zstd
-            gnugrep
-            git
-            zola
-          ];
+        packages = {
+          default = pkgs.stdenv.mkDerivation {
+            name = "alanpearce.eu";
+            src = self;
+
+            enableParallelBuilding = true;
+            makeFlags = [ "PREFIX=$(out)" ];
+
+            nativeBuildInputs = with pkgs; [
+              zola
+              fd
+              brotli
+              gzip
+              zstd
+              git
+            ];
+
+            dontFixup = true;
+          };
         };
       });
 }