Files
nix-config/systems/x86_64-linux/jallen-nas/nas-defaults.nix
mjallen18 03f6b730cf kek
2026-04-01 13:21:25 -05:00

90 lines
2.0 KiB
Nix

# NAS-wide defaults for all mkModule services.
#
# Every service's configDir and dataDir default to paths on the NAS bcachefs
# pool. Setting them here via lib.mkDefault means individual service
# declarations in apps.nix only need to override when they deviate from the
# convention, keeping apps.nix concise.
#
# The companion RequiresMountsFor in mkModule uses these paths to derive the
# correct systemd mount dependency automatically — no service needs to hardcode
# "media-nas-main.mount" by name.
{ lib, namespace, ... }:
let
appdata = "/media/nas/main/appdata";
data = "/media/nas/main";
svcDefault = name: {
${namespace}.services.${name} = {
configDir = lib.mkDefault appdata;
dataDir = lib.mkDefault data;
};
};
in
{
imports =
# Bespoke services with their own path option names (not configDir/dataDir).
[
{
${namespace}.services.ocis = {
dataPath = lib.mkDefault "${data}/ocis";
configPath = lib.mkDefault "${appdata}/ocis";
};
}
]
++ map svcDefault [
"actual"
"ai"
"arrs"
"attic"
"authentik"
"authentikRac"
"caddy"
"calibre"
"calibre-web"
"code-server"
"collabora"
"coturn"
"crowdsec"
"dispatcharr"
"free-games-claimer"
"gitea"
"glance"
"glances"
"grafana"
"guacd"
"grimmory"
"headscale"
"immich"
"jellyfin"
"seerr"
"kavita"
"lemonade"
"lubelogger"
"manyfold"
"matrix"
"minecraft"
"mongodb"
"nebula"
"netbootxyz"
"nextcloud"
"ntfy"
"onlyoffice"
"opencloud"
"orca-slicer"
"paperless"
"paperless-ai"
"protonmail-bridge"
"restic-server"
"sparky-fitness"
"sparky-fitness-server"
"sunshine"
"tdarr"
"termix"
"tunarr"
"unmanic"
"uptime-kuma"
"wyoming"
"your-spotify"
];
}