mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-19 20:09:01 +02:00
nixos/davfs2: Convert extraConfig to freeform type
This commit is contained in:
parent
bc95dfa2cd
commit
8616aca59a
|
@ -175,6 +175,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
|
|||
|
||||
- `paperless`' `services.paperless.extraConfig` setting has been removed and converted to the freeform type and option named `services.paperless.settings`.
|
||||
|
||||
- `davfs2`' `services.davfs2.extraConfig` setting has been deprecated and converted to the freeform type option named `services.davfs2.settings` according to RFC42.
|
||||
|
||||
- `services.homepage-dashboard` now takes it's configuration using native Nix expressions, rather than dumping templated configurations into `/var/lib/homepage-dashboard` where they were previously managed manually. There are now new options which allow the configuration of bookmarks, services, widgets and custom CSS/JS natively in Nix.
|
||||
|
||||
- `hare` may now be cross-compiled. For that to work, however, `haredoc` needed to stop being built together with it. Thus, the latter is now its own package with the name of `haredoc`.
|
||||
|
|
|
@ -3,14 +3,22 @@
|
|||
with lib;
|
||||
|
||||
let
|
||||
toStr = value:
|
||||
if true == value then "yes"
|
||||
else if false == value then "no"
|
||||
else toString value;
|
||||
|
||||
cfg = config.services.davfs2;
|
||||
cfgFile = pkgs.writeText "davfs2.conf" ''
|
||||
dav_user ${cfg.davUser}
|
||||
dav_group ${cfg.davGroup}
|
||||
format = pkgs.formats.toml { };
|
||||
configFile = let
|
||||
settings = mapAttrsToList (n: v: "${n} = ${toStr v}") cfg.settings;
|
||||
in pkgs.writeText "davfs2.conf" ''
|
||||
${concatStringsSep "\n" settings}
|
||||
${cfg.extraConfig}
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
||||
options.services.davfs2 = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
|
@ -49,13 +57,46 @@ in
|
|||
'';
|
||||
description = lib.mdDoc ''
|
||||
Extra lines appended to the configuration of davfs2.
|
||||
See {manpage}`davfs2.conf(5)` for available settings.
|
||||
|
||||
**Note**: Please pass structured settings via
|
||||
{option}`settings` instead, this option
|
||||
will get deprecated in the future.
|
||||
'' ;
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = types.submodule {
|
||||
freeformType = format.type;
|
||||
};
|
||||
default = {};
|
||||
example = literalExpression ''
|
||||
{
|
||||
kernel_fs = "coda";
|
||||
proxy = "foo.bar:8080";
|
||||
use_locks = 0;
|
||||
}
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Extra settings appended to the configuration of davfs2.
|
||||
See {manpage}`davfs2.conf(5)` for available settings.
|
||||
'' ;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
warnings = lib.optional (cfg.extraConfig != null) ''
|
||||
services.davfs2.extraConfig will be deprecated in future releases, please use the settings option now.
|
||||
'';
|
||||
|
||||
environment.systemPackages = [ pkgs.davfs2 ];
|
||||
environment.etc."davfs2/davfs2.conf".source = cfgFile;
|
||||
environment.etc."davfs2/davfs2.conf".source = configFile;
|
||||
|
||||
services.davfs2.settings = {
|
||||
dav_user = cfg.davUser;
|
||||
dav_group = cfg.davGroup;
|
||||
};
|
||||
|
||||
users.groups = optionalAttrs (cfg.davGroup == "davfs2") {
|
||||
davfs2.gid = config.ids.gids.davfs2;
|
||||
|
|
Loading…
Reference in a new issue