diff --git a/nixos/zigbee2mqtt.nix b/nixos/zigbee2mqtt.nix index a05e3d47..eca1124d 100644 --- a/nixos/zigbee2mqtt.nix +++ b/nixos/zigbee2mqtt.nix @@ -9,10 +9,10 @@ inherit (lib.modules) mkIf mkDefault; cfg = config.services.zigbee2mqtt; in { - sops.secrets.z2m-secret = { + sops.secrets.z2m-secret = mkIf cfg.enable { sopsFile = mkDefault ./secrets/zigbee2mqtt.yaml; owner = "zigbee2mqtt"; - path = "${cfg.dataDir}/secret.yaml"; + path = "${config.systemd.services.zigbee2mqtt.gensokyo-zone.sharedMounts.zigbee2mqtt.path}/secret.yaml"; }; services.zigbee2mqtt = { @@ -48,6 +48,14 @@ in { }; }; }; + systemd.services.zigbee2mqtt = mkIf cfg.enable { + gensokyo-zone = { + sharedMounts.zigbee2mqtt.path = cfg.dataDir; + cacheMounts."zigbee2mqtt/log" = { + path = "${cfg.dataDir}/log"; + }; + }; + }; services.udev.extraRules = mkIf cfg.enable '' SUBSYSTEM=="tty", ATTRS{interface}=="Sonoff Zigbee 3.0 USB Dongle Plus", OWNER="zigbee2mqtt", SYMLINK+="ttyZigbee" diff --git a/systems/reisen/setup.sh b/systems/reisen/setup.sh index 7ecfbe6c..47c1941a 100644 --- a/systems/reisen/setup.sh +++ b/systems/reisen/setup.sh @@ -138,6 +138,7 @@ chown 100000:30000 /rpool/shared/nix/store chmod 1775 /rpool/shared/nix/store chown 100000:100000 /rpool/shared/nix/var +mkcache zigbee2mqtt 100317 100317 0700 mkcache plex 0 0 0755 if [[ ! -d /rpool/caches/plex/Cache ]]; then mkdir /rpool/caches/plex/Cache