summary refs log tree commit diff
path: root/nixos/modules/security/pam_mount.nix
diff options
context:
space:
mode:
authorJenny <me@netali.de>2021-06-08 22:06:28 +0200
committerGitHub <noreply@github.com>2021-06-08 22:06:28 +0200
commit7bf7d9f8a741674f612987e879bd9bb2fb32a95f (patch)
treee98690c3a030f2fb9ba8f9cdab0016ab34397136 /nixos/modules/security/pam_mount.nix
parent0d1dae018c481a34aac6a6ac16eca48855b90319 (diff)
downloadnixpkgs-7bf7d9f8a741674f612987e879bd9bb2fb32a95f.tar
nixpkgs-7bf7d9f8a741674f612987e879bd9bb2fb32a95f.tar.gz
nixpkgs-7bf7d9f8a741674f612987e879bd9bb2fb32a95f.tar.bz2
nixpkgs-7bf7d9f8a741674f612987e879bd9bb2fb32a95f.tar.lz
nixpkgs-7bf7d9f8a741674f612987e879bd9bb2fb32a95f.tar.xz
nixpkgs-7bf7d9f8a741674f612987e879bd9bb2fb32a95f.tar.zst
nixpkgs-7bf7d9f8a741674f612987e879bd9bb2fb32a95f.zip
nixos/pam_mount: add support for FUSE-filesystems (#126069)
Diffstat (limited to 'nixos/modules/security/pam_mount.nix')
-rw-r--r--nixos/modules/security/pam_mount.nix25
1 files changed, 24 insertions, 1 deletions
diff --git a/nixos/modules/security/pam_mount.nix b/nixos/modules/security/pam_mount.nix
index 9a0143c155c..e25ace38f57 100644
--- a/nixos/modules/security/pam_mount.nix
+++ b/nixos/modules/security/pam_mount.nix
@@ -29,6 +29,28 @@ in
           xlink:href="http://pam-mount.sourceforge.net/pam_mount.conf.5.html" />.
         '';
       };
+
+      additionalSearchPaths = mkOption {
+        type = types.listOf types.package;
+        default = [];
+        example = literalExample "[ pkgs.bindfs ]";
+        description = ''
+          Additional programs to include in the search path of pam_mount.
+          Useful for example if you want to use some FUSE filesystems like bindfs.
+        '';
+      };
+
+      fuseMountOptions = mkOption {
+        type = types.listOf types.str;
+        default = [];
+        example = literalExample ''
+          [ "nodev" "nosuid" "force-user=%(USER)" "gid=%(USERGID)" "perms=0700" "chmod-deny" "chown-deny" "chgrp-deny" ]
+        '';
+        description = ''
+          Global mount options that apply to every FUSE volume.
+          You can define volume-specific options in the volume definitions.
+        '';
+      };
     };
 
   };
@@ -60,11 +82,12 @@ in
           <!-- if activated, requires ofl from hxtools to be present -->
           <logout wait="0" hup="no" term="no" kill="no" />
           <!-- set PATH variable for pam_mount module -->
-          <path>${pkgs.util-linux}/bin</path>
+          <path>${makeBinPath ([ pkgs.util-linux ] ++ cfg.additionalSearchPaths)}</path>
           <!-- create mount point if not present -->
           <mkmountpoint enable="1" remove="true" />
 
           <!-- specify the binaries to be called -->
+          <fusemount>${pkgs.fuse}/bin/mount.fuse %(VOLUME) %(MNTPT) -o ${concatStringsSep "," (cfg.fuseMountOptions ++ [ "%(OPTIONS)" ])}</fusemount>
           <cryptmount>${pkgs.pam_mount}/bin/mount.crypt %(VOLUME) %(MNTPT)</cryptmount>
           <cryptumount>${pkgs.pam_mount}/bin/umount.crypt %(MNTPT)</cryptumount>
           <pmvarrun>${pkgs.pam_mount}/bin/pmvarrun -u %(USER) -o %(OPERATION)</pmvarrun>