Skip to content

Commit

Permalink
nixos/davfs2: ensure extraConfig and settings are mutually exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
eclairevoyant committed Apr 11, 2024
1 parent fc94606 commit ee6bbd5
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions nixos/modules/services/network-filesystems/davfs2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ let
else if builtins.isString value then "\"${escapeString value}\""
else toString value;

configFile = pkgs.writeText "davfs2.conf" ''
${toINIWithGlobalSection {
mkSectionName = escapeString;
mkKeyValue = k: v: "${k} ${formatValue v}";
} cfg.settings}
${cfg.extraConfig}
'';
configFile = pkgs.writeText "davfs2.conf" (
if (cfg.settings != { }) then
(toINIWithGlobalSection {
mkSectionName = escapeString;
mkKeyValue = k: v: "${k} ${formatValue v}";
} cfg.settings)
else
cfg.extraConfig
);
in
{

Expand Down Expand Up @@ -107,6 +109,16 @@ in

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 != "") ''
services.davfs2.extraConfig will be deprecated in future releases;
please use services.davfs2.settings instead.
Expand Down

0 comments on commit ee6bbd5

Please sign in to comment.