1{ config, lib, ... }:
2
3let
4 cfg = config.programs.fuse;
5in
6{
7 meta.maintainers = with lib.maintainers; [ primeos ];
8
9 options.programs.fuse = {
10 mountMax = lib.mkOption {
11 # In the C code it's an "int" (i.e. signed and at least 16 bit), but
12 # negative numbers obviously make no sense:
13 type = lib.types.ints.between 0 32767; # 2^15 - 1
14 default = 1000;
15 description = ''
16 Set the maximum number of FUSE mounts allowed to non-root users.
17 '';
18 };
19
20 userAllowOther = lib.mkOption {
21 type = lib.types.bool;
22 default = false;
23 description = ''
24 Allow non-root users to specify the allow_other or allow_root mount
25 options, see mount.fuse3(8).
26 '';
27 };
28 };
29
30 config = {
31 environment.etc."fuse.conf".text = ''
32 ${lib.optionalString (!cfg.userAllowOther) "#"}user_allow_other
33 mount_max = ${builtins.toString cfg.mountMax}
34 '';
35 };
36}