···1616 generate = name: value:
1717 let mkParam = k: v:
1818 if v == null then []
1919- else if isBool v then if v then [("--"+k)] else []
1919+ else if isBool v then optional v ("--"+k)
2020 else [("--"+k) v];
2121 mkParams = k: v: map (mkParam k) (if isList v then v else [v]);
2222 in escapeShellArgs (concatLists (concatLists (mapAttrsToList mkParams value)));
···305305306306 # If you really have to access root via FTP use mkOverride or userlistDeny
307307 # = false and whitelist root
308308- services.vsftpd.userlist = if cfg.userlistDeny then ["root"] else [];
308308+ services.vsftpd.userlist = optional cfg.userlistDeny "root";
309309310310 systemd = {
311311 tmpfiles.rules = optional cfg.anonymousUser
+2-3
nixos/modules/services/security/tor.nix
···769769 };
770770 options.SOCKSPort = mkOption {
771771 description = lib.mdDoc (descriptionGeneric "SOCKSPort");
772772- default = if cfg.settings.HiddenServiceNonAnonymousMode == true then [{port = 0;}] else [];
772772+ default = lib.optionals cfg.settings.HiddenServiceNonAnonymousMode [{port = 0;}];
773773 defaultText = literalExpression ''
774774 if config.${opt.settings}.HiddenServiceNonAnonymousMode == true
775775 then [ { port = 0; } ]
···897897 allowedTCPPorts =
898898 concatMap (o:
899899 if isInt o && o > 0 then [o]
900900- else if o ? "port" && isInt o.port && o.port > 0 then [o.port]
901901- else []
900900+ else optionals (o ? "port" && isInt o.port && o.port > 0) [o.port]
902901 ) (flatten [
903902 cfg.settings.ORPort
904903 cfg.settings.DirPort
+1-1
nixos/modules/services/web-apps/dex.nix
···66 cfg = config.services.dex;
77 fixClient = client: if client ? secretFile then ((builtins.removeAttrs client [ "secretFile" ]) // { secret = client.secretFile; }) else client;
88 filteredSettings = mapAttrs (n: v: if n == "staticClients" then (builtins.map fixClient v) else v) cfg.settings;
99- secretFiles = flatten (builtins.map (c: if c ? secretFile then [ c.secretFile ] else []) (cfg.settings.staticClients or []));
99+ secretFiles = flatten (builtins.map (c: optional (c ? secretFile) c.secretFile) (cfg.settings.staticClients or []));
10101111 settingsFormat = pkgs.formats.yaml {};
1212 configFile = settingsFormat.generate "config.yaml" filteredSettings;
+1-3
nixos/modules/services/web-apps/mastodon.nix
···91919292 envFile = pkgs.writeText "mastodon.env" (lib.concatMapStrings (s: s + "\n") (
9393 (lib.concatLists (lib.mapAttrsToList (name: value:
9494- if value != null then [
9595- "${name}=\"${toString value}\""
9696- ] else []
9494+ lib.optional (value != null) ''${name}="${toString value}"''
9795 ) env))));
98969997 mastodonTootctl = let