1 { config, lib, pkgs, ... }:
6 cfg = config.services.davfs2;
7 cfgFile = pkgs.writeText "davfs2.conf" ''
8 dav_user ${cfg.davUser}
9 dav_group ${cfg.davGroup}
14 options.services.davfs2 = {
18 description = lib.mdDoc ''
19 Whether to enable davfs2.
26 description = lib.mdDoc ''
27 When invoked by root the mount.davfs daemon will run as this user.
28 Value must be given as name, not as numerical id.
35 description = lib.mdDoc ''
36 The group of the running mount.davfs daemon. Ordinary users must be
37 member of this group in order to mount a davfs2 file system. Value must
38 be given as name, not as numerical id.
42 extraConfig = mkOption {
50 description = lib.mdDoc ''
51 Extra lines appended to the configuration of davfs2.
56 config = mkIf cfg.enable {
57 environment.systemPackages = [ pkgs.davfs2 ];
58 environment.etc."davfs2/davfs2.conf".source = cfgFile;
60 users.groups = optionalAttrs (cfg.davGroup == "davfs2") {
61 davfs2.gid = config.ids.gids.davfs2;
64 users.users = optionalAttrs (cfg.davUser == "davfs2") {
68 uid = config.ids.uids.davfs2;
69 description = "davfs2 user";
73 security.wrappers."mount.davfs" = {
74 program = "mount.davfs";
75 source = "${pkgs.davfs2}/bin/mount.davfs";
79 permissions = "u+rx,g+x";
82 security.wrappers."umount.davfs" = {
83 program = "umount.davfs";
84 source = "${pkgs.davfs2}/bin/umount.davfs";
88 permissions = "u+rx,g+x";