nixos/fuse: init

Add a module for /etc/fuse.conf.
Fixes #30923.
This commit is contained in:
Michael Weiss 2019-08-11 15:36:33 +02:00
parent 18fa1c335e
commit 2473d902e6
No known key found for this signature in database
GPG Key ID: 5BE487C4D4771D83
3 changed files with 41 additions and 3 deletions

View File

@ -111,6 +111,7 @@
./programs/firejail.nix
./programs/fish.nix
./programs/freetds.nix
./programs/fuse.nix
./programs/gnome-disks.nix
./programs/gnome-documents.nix
./programs/gpaste.nix

View File

@ -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}
'';
};
}

View File

@ -208,9 +208,9 @@ in {
config = mkIf cfg.enable {
environment.systemPackages = [ wrapped ];
environment.etc."fuse.conf" = mkIf cfg.autoMount { text = ''
user_allow_other
''; };
programs.fuse = mkIf cfg.autoMount {
userAllowOther = true;
};
users.users = mkIf (cfg.user == "ipfs") {
ipfs = {