From 8eebaf8cee812bd07d8d890040e403bacb1777fb Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 3 Nov 2025 07:23:57 -0800 Subject: consolidate all modules under modules/ --- modules/nixos/nas-client.nix | 84 -------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 modules/nixos/nas-client.nix (limited to 'modules/nixos/nas-client.nix') diff --git a/modules/nixos/nas-client.nix b/modules/nixos/nas-client.nix deleted file mode 100644 index fe0952e..0000000 --- a/modules/nixos/nas-client.nix +++ /dev/null @@ -1,84 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -let - cfg = config.my.modules.nas-client; -in -{ - options.my.modules.nas-client = with lib; { - enable = mkEnableOption "NAS client"; - - volumes = mkOption { - type = types.attrsOf ( - types.submodule { - options = { - server = mkOption { - type = types.str; - example = "nas"; - description = "Hostname of the server to connect to."; - }; - remotePath = mkOption { - type = types.str; - example = "data"; - description = "Remote path on the NAS to mount."; - }; - mountPoint = mkOption { - type = types.str; - description = "Local directory where the volume will be mounted."; - }; - uid = mkOption { - type = types.int; - default = 1000; - description = "User ID for mounted files."; - }; - gid = mkOption { - type = types.int; - default = 1000; - description = "Group ID for mounted files."; - }; - options = mkOption { - type = types.str; - default = "rw"; - description = "Additional mount options."; - }; - }; - } - ); - default = { }; - description = "NAS volumes to mount."; - }; - }; - - config = lib.mkIf cfg.enable { - boot.kernelModules = [ - "cifs" - "cmac" - "sha256" - ]; - - # this is required to get the credentials options to work - environment.systemPackages = [ pkgs.cifs-utils ]; - - systemd.mounts = lib.mapAttrsToList (name: volume: { - description = "Mount for NAS volume ${name}"; - what = "//${volume.server}/${volume.remotePath}"; - where = volume.mountPoint; - unitConfig = { - # This ensures it uses mount.cifs - Type = "cifs"; - }; - type = "cifs"; # Explicitly specify CIFS type otherwise we ran into issues when using the credentials file option - options = "credentials=${config.age.secrets.nas_client_credentials.path},uid=${toString volume.uid},gid=${toString volume.gid},${volume.options}"; - }) cfg.volumes; - - systemd.automounts = lib.mapAttrsToList (name: volume: { - description = "Automount for NAS volume ${name}"; - where = volume.mountPoint; - wantedBy = [ "multi-user.target" ]; - }) cfg.volumes; - }; -} -- cgit v1.2.3