Unverified Commit a60e4033 authored by éclairevoyant's avatar éclairevoyant
Browse files

nixos/davfs2: ensure extraConfig and settings are mutually exclusive

parent 10c54292
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -19,13 +19,15 @@ let
    else if builtins.isString value then "\"${escapeString value}\""
    else toString value;

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

@@ -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.