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