diff --git a/modules/config/instances/config/samba.nix b/modules/config/instances/config/samba.nix index fac9afe..f364d9c 100755 --- a/modules/config/instances/config/samba.nix +++ b/modules/config/instances/config/samba.nix @@ -1,11 +1,6 @@ { instancesFunctions }: let inherit (instancesFunctions) - jellyfinLabel - jellyfinName - audiobookshelfLabel - audiobookshelfName - servicePath sopsPath ; @@ -19,12 +14,6 @@ in path0 = "${sopsPath}/${sambaName}"; }; paths = { - path0 = "${servicePath}/${jellyfinLabel}"; - path1 = jellyfinName; - path2 = ""; - path3 = "${servicePath}/${audiobookshelfLabel}"; - path4 = audiobookshelfName; - path6 = ""; }; ports = { port0 = 445; # Samba diff --git a/modules/nixos/services/samba/default.nix b/modules/nixos/services/samba/default.nix index f721cbc..3a0e051 100755 --- a/modules/nixos/services/samba/default.nix +++ b/modules/nixos/services/samba/default.nix @@ -20,11 +20,11 @@ in enable = true; openFirewall = true; settings = { - ${service.paths.path1} = { + ${jellyfin.name} = { path = jellyfin.paths.path0; writable = "true"; }; - ${service.paths.path4} = { + ${audiobookshelf.name} = { path = audiobookshelf.paths.path0; writable = "true"; }; diff --git a/systems/mars/config/filesystem.nix b/systems/mars/config/filesystem.nix index 5574d13..4e6dcf2 100755 --- a/systems/mars/config/filesystem.nix +++ b/systems/mars/config/filesystem.nix @@ -15,8 +15,9 @@ let ; inherit (flake.config.services.instances) samba + jellyfin + audiobookshelf ; - synologySecrets = config.sops.secrets."network/synology".path; ceresSecrets = config.sops.secrets."network/server".path; in @@ -38,6 +39,11 @@ in "samba0" ]; + sambaFolders = [ + audiobookshelf.name + jellyfin.name + ]; + synologyMounts = synologyDrive: { name = "${synology.${synologyDrive}.mount}"; value = { @@ -58,10 +64,10 @@ in }; }; - sambaMounts = sambaDrive: { - name = "${ceres.${sambaDrive}.mount}/${samba.paths.path1}"; + sambaMounts = sambaDrive: folder: { + name = "${ceres.${sambaDrive}.mount}/${folder}"; value = { - device = "${ceres.${sambaDrive}.device}/${samba.paths.path1}"; + device = "${ceres.${sambaDrive}.device}/${folder}"; fsType = "cifs"; options = ceres.${sambaDrive}.options ++ [ "credentials=${ceresSecrets}" @@ -82,7 +88,9 @@ in } // (builtins.listToAttrs (map synologyMounts synologyDrives)) // (builtins.listToAttrs (map storageMounts storageDrives)) - // (builtins.listToAttrs (map sambaMounts sambaDrives)); + // (builtins.listToAttrs ( + builtins.concatMap (drive: map (folder: sambaMounts drive folder) sambaFolders) sambaDrives + )); swapDevices = [ { device = "/dev/disk/by-uuid/8b1d43a7-baf8-4d15-a1ad-dc0c9dda6970"; }