From b0b7852ba6363073c9769246979786fcd1139b16 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Mon, 11 Nov 2024 18:48:54 +0800 Subject: [PATCH] docs: make base URL configurable through Nix --- Makefile | 4 +++- docs/default.nix | 4 ++++ docs/hugo-build-module.nix | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index aadd9eb..a8c0572 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +BASEURL := "https://foo-dogsquared.github.io/nix-module-wrapper-manager-fds" + .PHONY: docs-serve docs-serve: hugo -s docs/website serve @@ -8,7 +10,7 @@ docs-build: .PHONY: build build: - { command -v nix >/dev/null && nix build -f docs/ website; } || { nix-build docs/ -A website; } + { command -v nix >/dev/null && nix build -f docs/ --argstr baseUrl $(BASEURL) website; } || { nix-build docs/ -A website --argstr baseUrl $(BASEURL); } .PHONY: check check: diff --git a/docs/default.nix b/docs/default.nix index bd79e8d..034809a 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -106,6 +106,8 @@ in ]; }; in + { baseUrl ? "https://foo-dogsquared.github.io/nix-module-wrapper-manager-fds" }: + buildHugoSite { pname = "wrapper-manager-docs"; version = "2024-07-13"; @@ -124,6 +126,8 @@ in vendorHash = "sha256-qsmXolxEcYjY2jwIlPRqir5gE8TeVknPGIGF4g89x54="; + buildFlags = [ "--baseURL" baseUrl ]; + nativeBuildInputs = [ asciidoctorWrapped gems diff --git a/docs/hugo-build-module.nix b/docs/hugo-build-module.nix index 9d1e5ba..1b164ed 100644 --- a/docs/hugo-build-module.nix +++ b/docs/hugo-build-module.nix @@ -279,7 +279,7 @@ let buildPhase = args.buildPhase or '' runHook preBuild - hugo "''${buildFlags[@]}" --destination public + hugo ''${buildFlags[@]} --destination public runHook postBuild '';