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