Unverified Commit bdd0b60b authored by Sizhe Zhao's avatar Sizhe Zhao Committed by GitHub
Browse files

nixos/firewalld: convert bool settings to yes/no (#502926)

parents 72863bd0 3ddc937b
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
{
  config,
  lib,
  pkgs,
  ...
}:

let
  cfg = config.services.firewalld;
  format = pkgs.formats.keyValue { };
  inherit (lib) mkOption;
  inherit (lib.types)
    attrsOf
    bool
    commas
    either
    enum
    nonEmptyStr
    oneOf
    separatedString
    submodule
    ;
@@ -27,7 +27,10 @@ in
    '';
    default = { };
    type = submodule {
      freeformType = format.type;
      freeformType = attrsOf (oneOf [
        bool
        nonEmptyStr
      ]);
      options = {
        DefaultZone = mkOption {
          type = nonEmptyStr;
@@ -191,8 +194,8 @@ in
      }
    ];

    environment.etc."firewalld/firewalld.conf" = {
      source = format.generate "firewalld.conf" cfg.settings;
    };
    environment.etc."firewalld/firewalld.conf".text = lib.concatMapAttrsStringSep "\n" (
      k: v: "${k}=${if lib.isBool v then lib.boolToYesNo v else v}"
    ) cfg.settings;
  };
}