From 5f5aa86ce21ad8f2c1ac8d50e7d262720e0a2ce2 Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Mon, 7 Apr 2025 00:46:43 +1000 Subject: [PATCH] hosts/hazel: move services data to /flower --- hosts/hazel/default.nix | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hosts/hazel/default.nix b/hosts/hazel/default.nix index 9926c7f..7f4d1cc 100644 --- a/hosts/hazel/default.nix +++ b/hosts/hazel/default.nix @@ -1,4 +1,24 @@ -{ config, modules, pkgs, ... }: { +{ config, modules, pkgs, ... }: +let + dirs = [ + ["immich" "immich"] + ["nextcloud" "nextcloud"] + ["postgresql" "postgres"] + ["redis-immich" "redis-immich"] + ]; + + rules = builtins.map (d: "d /flower/${builtins.elemAt d 0} 750 ${builtins.elemAt d 1} ${builtins.elemAt d 1}") dirs; + mounts = builtins.listToAttrs (builtins.map (d: { + name = "/var/lib/${builtins.elemAt d 0}"; + value = { + depends = [ "/flower" ]; + device = "/flower/${builtins.elemAt d 0}"; + fsType = "none"; + options = [ "bind" ]; + }; + }) dirs); +in +{ networking.hostName = "hazel"; system.stateVersion = "24.11"; time.timeZone = "Australia/Melbourne"; @@ -65,4 +85,7 @@ ''; }; }; + + systemd.tmpfiles.rules = rules; + fileSystems = mounts; }