mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-15 14:09:17 +03:00
nixos/davfs2: ensure extraConfig and settings are mutually exclusive
This commit is contained in:
parent
10c5429290
commit
a60e4033ca
1 changed files with 19 additions and 7 deletions
|
@ -19,13 +19,15 @@ let
|
||||||
else if builtins.isString value then "\"${escapeString value}\""
|
else if builtins.isString value then "\"${escapeString value}\""
|
||||||
else toString value;
|
else toString value;
|
||||||
|
|
||||||
configFile = pkgs.writeText "davfs2.conf" ''
|
configFile = pkgs.writeText "davfs2.conf" (
|
||||||
${toINIWithGlobalSection {
|
if (cfg.settings != { }) then
|
||||||
mkSectionName = escapeString;
|
(toINIWithGlobalSection {
|
||||||
mkKeyValue = k: v: "${k} ${formatValue v}";
|
mkSectionName = escapeString;
|
||||||
} cfg.settings}
|
mkKeyValue = k: v: "${k} ${formatValue v}";
|
||||||
${cfg.extraConfig}
|
} cfg.settings)
|
||||||
'';
|
else
|
||||||
|
cfg.extraConfig
|
||||||
|
);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -107,6 +109,16 @@ in
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.extraConfig != "" -> cfg.settings == { };
|
||||||
|
message = ''
|
||||||
|
services.davfs2.extraConfig and services.davfs2.settings cannot be used together.
|
||||||
|
Please prefer using services.davfs2.settings.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
warnings = optional (cfg.extraConfig != "") ''
|
warnings = optional (cfg.extraConfig != "") ''
|
||||||
services.davfs2.extraConfig will be deprecated in future releases;
|
services.davfs2.extraConfig will be deprecated in future releases;
|
||||||
please use services.davfs2.settings instead.
|
please use services.davfs2.settings instead.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue