aboutsummaryrefslogtreecommitdiff
path: root/modules/nixos/nas-client.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2025-11-03 07:23:57 -0800
committerFranck Cuny <franck@fcuny.net>2025-11-03 07:23:57 -0800
commit8eebaf8cee812bd07d8d890040e403bacb1777fb (patch)
tree2991267489e3387e1c36a718a54b35fa2b695937 /modules/nixos/nas-client.nix
parentfix remote script (diff)
downloadinfra-8eebaf8cee812bd07d8d890040e403bacb1777fb.tar.gz
consolidate all modules under modules/
Diffstat (limited to 'modules/nixos/nas-client.nix')
-rw-r--r--modules/nixos/nas-client.nix84
1 files changed, 0 insertions, 84 deletions
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;
- };
-}