nix-configs

Personal NixOS and home-manager configuration files
Log | Files | Refs

commit 80058f5d8fc52b645a6601e09ba8714d92a5ec34
parent 96a8d705d8bf9d4b15f05966ef059e0261872d7c
Author: breadcat <breadcat@users.noreply.github.com>
Date:   Sun, 17 May 2026 07:05:18 +0100

Hugo and Docker webdev loop

Diffstat:
Acommon/docker-webdev.nix | 33+++++++++++++++++++++++++++++++++
Mmachines/artemis.nix | 1+
2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/common/docker-webdev.nix b/common/docker-webdev.nix @@ -0,0 +1,33 @@ +{ config, lib, username, ... }: + +let + + webdevDir = "/home/${username}/vault/src/webdev"; + domainExtensions = [ ".com" ".net" ".org" ".co.uk" ".dev" ]; + + domains = builtins.attrNames ( + lib.filterAttrs + (name: type: + type == "directory" && + builtins.any (ext: lib.hasSuffix ext name) domainExtensions) + (builtins.readDir webdevDir)); + + containerName = domain: "hugo-${lib.replaceStrings ["."] ["-"] domain}"; + + makeHugoContainer = domain: { + name = containerName domain; + value = { + autoStart = true; + dependsOn = [ "caddy" ]; + image = "klakegg/hugo"; + cmd = [ "server" "--watch=true" "--disableLiveReload" "--minify" "--source=/src" "--baseURL=https://${domain}" "--bind=0.0.0.0" "--appendPort=false" "--buildFuture" ]; + labels = { "caddy" = "${domain}, www.${domain}"; "caddy.reverse_proxy" = "{{upstreams 1313}}"; }; + networks = [ "proxy" ]; + volumes = [ "${webdevDir}/${domain}:/src" ]; + }; + }; + +in { + virtualisation.oci-containers.containers = + builtins.listToAttrs (map makeHugoContainer domains); +} diff --git a/machines/artemis.nix b/machines/artemis.nix @@ -9,6 +9,7 @@ let machine = "artemis"; in { (import ../common/home-manager.nix { inherit machine fullname username domain email sshkey sshport timezone postcode address htpasswd vpnusername vpnpassword todosecret privatekey matrixuser matrixserver; }) ../common/boot-systemd.nix ../common/docker.nix + ../common/docker-webdev.nix ../common/flakes.nix ../common/garbage.nix ../common/locale.nix