davfs2: create user/group davfs2 if not specified in the configuration
* Add options: - enable - davUser (default: "davfs2") - davGroup (default: "davfs2) * Add davfs2 user or group if they are not specified in the configuration
This commit is contained in:
parent
1354099daf
commit
9724654c74
|
@ -401,6 +401,7 @@
|
||||||
./services/monitoring/zabbix-agent.nix
|
./services/monitoring/zabbix-agent.nix
|
||||||
./services/monitoring/zabbix-server.nix
|
./services/monitoring/zabbix-server.nix
|
||||||
./services/network-filesystems/cachefilesd.nix
|
./services/network-filesystems/cachefilesd.nix
|
||||||
|
./services/network-filesystems/davfs2.nix
|
||||||
./services/network-filesystems/drbd.nix
|
./services/network-filesystems/drbd.nix
|
||||||
./services/network-filesystems/glusterfs.nix
|
./services/network-filesystems/glusterfs.nix
|
||||||
./services/network-filesystems/kbfs.nix
|
./services/network-filesystems/kbfs.nix
|
||||||
|
|
74
nixos/modules/services/network-filesystems/davfs2.nix
Normal file
74
nixos/modules/services/network-filesystems/davfs2.nix
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.davfs2;
|
||||||
|
cfgFile = pkgs.writeText "davfs2.conf" ''
|
||||||
|
dav_user ${cfg.davUser}
|
||||||
|
dav_group ${cfg.davGroup}
|
||||||
|
${cfg.extraConfig}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.davfs2 = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable davfs2.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
davUser = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
default = "davfs2";
|
||||||
|
description = ''
|
||||||
|
When invoked by root the mount.davfs daemon will run as this user.
|
||||||
|
Value must be given as name, not as numerical id.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
davGroup = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
default = "davfs2";
|
||||||
|
description = ''
|
||||||
|
The group of the running mount.davfs daemon. Ordinary users must be
|
||||||
|
member of this group in order to mount a davfs2 file system. Value must
|
||||||
|
be given as name, not as numerical id.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
example = ''
|
||||||
|
kernel_fs coda
|
||||||
|
proxy foo.bar:8080
|
||||||
|
use_locks 0
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Extra lines appended to the configuration of davfs2.
|
||||||
|
'' ;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ pkgs.davfs2 ];
|
||||||
|
environment.etc."davfs2/davfs2.conf".source = cfgFile;
|
||||||
|
|
||||||
|
users.extraGroups = optionalAttrs (cfg.davGroup == "davfs2") (singleton {
|
||||||
|
name = "davfs2";
|
||||||
|
gid = config.ids.gids.davfs2;
|
||||||
|
});
|
||||||
|
|
||||||
|
users.extraUsers = optionalAttrs (cfg.davUser == "davfs2") (singleton {
|
||||||
|
name = "davfs2";
|
||||||
|
createHome = false;
|
||||||
|
group = cfg.davGroup;
|
||||||
|
uid = config.ids.uids.davfs2;
|
||||||
|
description = "davfs2 user";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue