about summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-08-14 10:16:02 -0400
committerGitHub <noreply@github.com>2019-08-14 10:16:02 -0400
commit3411c1566a29bb2a75a9bfdf28c30240d4b3f8d8 (patch)
treee8b801c9393bcc7caad0e0d886e7c5b7f1feda3b /nixos/modules/programs
parent930659b10bc7c875fd49b1cdae21a631b429c25a (diff)
parent62f7711e29713c4dceeb00a956363ebdb01e20ec (diff)
downloadnixlib-3411c1566a29bb2a75a9bfdf28c30240d4b3f8d8.tar
nixlib-3411c1566a29bb2a75a9bfdf28c30240d4b3f8d8.tar.gz
nixlib-3411c1566a29bb2a75a9bfdf28c30240d4b3f8d8.tar.bz2
nixlib-3411c1566a29bb2a75a9bfdf28c30240d4b3f8d8.tar.lz
nixlib-3411c1566a29bb2a75a9bfdf28c30240d4b3f8d8.tar.xz
nixlib-3411c1566a29bb2a75a9bfdf28c30240d4b3f8d8.tar.zst
nixlib-3411c1566a29bb2a75a9bfdf28c30240d4b3f8d8.zip
Merge pull request #66480 from primeos/nixos-fuse
nixos/fuse: init
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/fuse.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/nixos/modules/programs/fuse.nix b/nixos/modules/programs/fuse.nix
new file mode 100644
index 000000000000..c15896efbb51
--- /dev/null
+++ b/nixos/modules/programs/fuse.nix
@@ -0,0 +1,37 @@
+{ config, lib, ... }:
+
+with lib;
+
+let
+  cfg = config.programs.fuse;
+in {
+  meta.maintainers = with maintainers; [ primeos ];
+
+  options.programs.fuse = {
+    mountMax = mkOption {
+      # In the C code it's an "int" (i.e. signed and at least 16 bit), but
+      # negative numbers obviously make no sense:
+      type = types.ints.between 0 32767; # 2^15 - 1
+      default = 1000;
+      description = ''
+        Set the maximum number of FUSE mounts allowed to non-root users.
+      '';
+    };
+
+    userAllowOther = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+        Allow non-root users to specify the allow_other or allow_root mount
+        options, see mount.fuse3(8).
+      '';
+    };
+  };
+
+  config =  {
+    environment.etc."fuse.conf".text = ''
+      ${optionalString (!cfg.userAllowOther) "#"}user_allow_other
+      mount_max = ${toString cfg.mountMax}
+    '';
+  };
+}