From b507af2a03ef02b8b62eb0310d2a2944e1179daf Mon Sep 17 00:00:00 2001 From: kurogeek Date: Wed, 11 Feb 2026 17:07:01 +0700 Subject: [PATCH] machines/sirius: no dedicated samba --- machines/sirius/configuration.nix | 4 -- machines/sirius/services/samba.nix | 93 ------------------------------ 2 files changed, 97 deletions(-) delete mode 100644 machines/sirius/services/samba.nix diff --git a/machines/sirius/configuration.nix b/machines/sirius/configuration.nix index 3ec56f7..199893f 100644 --- a/machines/sirius/configuration.nix +++ b/machines/sirius/configuration.nix @@ -1,5 +1,4 @@ { - inputs, config, self, ... @@ -7,9 +6,6 @@ { imports = [ self.nixosModules.common - - (inputs.import-tree ./services) - ]; clan.core.sops.defaultGroups = [ "admins" ]; diff --git a/machines/sirius/services/samba.nix b/machines/sirius/services/samba.nix deleted file mode 100644 index 8ce4b5b..0000000 --- a/machines/sirius/services/samba.nix +++ /dev/null @@ -1,93 +0,0 @@ -{ - config, - lib, - ... -}: -let - sambaUser = lib.filterAttrs ( - name: user: user.isNormalUser && builtins.elem "samba" user.extraGroups - ) config.users.users; - - sharedFolders = { - WhiteHouse.users = [ - "w" - "kurogeek" - "berwn" - ]; - }; -in -{ - - services.samba = { - enable = true; - openFirewall = true; - settings = { - global = { - security = "user"; - workgroup = "WORKGROUP"; - "server string" = "WhiteHouse NAS"; - interfaces = "eth* en*"; - "max log size" = "50"; - "dns proxy" = false; - "syslog only" = true; - "map to guest" = "Bad User"; - "guest account" = "nobody"; - }; - } - // lib.mapAttrs (share: opts: { - path = "/mnt/hdd/samba/${share}"; - comment = share; - "force user" = share; - "force group" = share; - public = "yes"; - "guest ok" = "yes"; - "create mask" = "0640"; - "directory mask" = "0750"; - writable = "no"; - browseable = "yes"; - printable = "no"; - # TODO - # "valid users" = toString opts.users; - }) sharedFolders; - }; - - users.users = lib.mapAttrs (share: opts: { - isSystemUser = true; - group = share; - }) sharedFolders; - - users.groups = lib.mapAttrs (share: opts: { }) sharedFolders; - - systemd.services.samba-smbd.postStart = - lib.concatMapStrings ( - user: - let - password = config.clan.core.vars.generators."${user}-smb-password".files.password.path; - in - '' - mkdir -p /mnt/hdd/samba/${user} - chown ${user}:users /mnt/hdd/samba/${user} - # if a password is unchanged, this will error - (echo $(<${password}); echo $(<${password})) | ${config.services.samba.package}/bin/smbpasswd -s -a ${user} - '' - ) (lib.attrNames sambaUser) - + lib.concatMapStrings (share: '' - mkdir -p /mnt/hdd/samba/${share} - chown ${share}:${share} /mnt/hdd/samba/${share} - '') (lib.attrNames sharedFolders); - - services.samba-wsdd = { - enable = true; - openFirewall = true; - }; - - services.avahi = { - publish.enable = true; - publish.userServices = true; - # ^^ Needed to allow samba to automatically register mDNS records (without the need for an `extraServiceFile` - nssmdns4 = true; - # ^^ Not one hundred percent sure if this is needed- if it aint broke, don't fix it - enable = true; - openFirewall = true; - }; -}