diff --git a/nixos/modules/config/getaddrinfo.nix b/nixos/modules/config/getaddrinfo.nix index f18651a9e031..ddea509bfa78 100644 --- a/nixos/modules/config/getaddrinfo.nix +++ b/nixos/modules/config/getaddrinfo.nix @@ -18,7 +18,7 @@ let [ "# Generated by NixOS module networking.getaddrinfo" "# Do not edit manually!" - "reload ${if cfg.reload then "yes" else "no"}" + "reload ${lib.boolToYesNo cfg.reload}" ] ++ formatTableEntries "label" cfg.label ++ formatTableEntries "precedence" cfg.precedence diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix index 092852330437..0980e6f385a2 100644 --- a/nixos/modules/misc/locate.nix +++ b/nixos/modules/misc/locate.nix @@ -241,7 +241,7 @@ in PRUNEFS="${lib.concatStringsSep " " cfg.pruneFS}" PRUNENAMES="${lib.concatStringsSep " " cfg.pruneNames}" PRUNEPATHS="${lib.concatStringsSep " " cfg.prunePaths}" - PRUNE_BIND_MOUNTS="${if cfg.pruneBindMounts then "yes" else "no"}" + PRUNE_BIND_MOUNTS="${lib.boolToYesNo cfg.pruneBindMounts}" ''; systemPackages = [ cfg.package ]; @@ -267,7 +267,7 @@ in '' exec ${cfg.package}/bin/updatedb \ --output ${toString cfg.output} ${lib.concatStringsSep " " args} \ - --prune-bind-mounts ${if cfg.pruneBindMounts then "yes" else "no"} \ + --prune-bind-mounts ${lib.boolToYesNo cfg.pruneBindMounts} \ ${lib.concatStringsSep " " cfg.extraFlags} ''; serviceConfig = { diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix index 443878715bc0..508d1961c770 100644 --- a/nixos/modules/programs/ssh.nix +++ b/nixos/modules/programs/ssh.nix @@ -357,7 +357,7 @@ in ] ++ lib.optional (!config.networking.enableIPv6) "AddressFamily inet" ++ lib.optional cfg.setXAuthLocation "XAuthLocation ${pkgs.xorg.xauth}/bin/xauth" - ++ lib.optional (cfg.forwardX11 != null) "ForwardX11 ${if cfg.forwardX11 then "yes" else "no"}" + ++ lib.optional (cfg.forwardX11 != null) "ForwardX11 ${lib.boolToYesNo cfg.forwardX11}" ++ lib.optional ( cfg.pubkeyAcceptedKeyTypes != [ ] ) "PubkeyAcceptedKeyTypes ${builtins.concatStringsSep "," cfg.pubkeyAcceptedKeyTypes}" diff --git a/nixos/modules/security/auditd.nix b/nixos/modules/security/auditd.nix index bbe22fa6a5bc..f9e7fd6084c1 100644 --- a/nixos/modules/security/auditd.nix +++ b/nixos/modules/security/auditd.nix @@ -86,7 +86,7 @@ let prepareConfigValue = v: if lib.isBool v then - (if v then "yes" else "no") + lib.boolToYesNo v else if lib.isList v then lib.concatStringsSep " " (map prepareConfigValue v) else diff --git a/nixos/modules/security/duosec.nix b/nixos/modules/security/duosec.nix index b8ff3ae18856..3734bc89e402 100644 --- a/nixos/modules/security/duosec.nix +++ b/nixos/modules/security/duosec.nix @@ -6,8 +6,7 @@ }: let cfg = config.security.duosec; - - boolToStr = b: if b then "yes" else "no"; + inherit (lib) boolToYesNo; configFilePam = '' [duo] @@ -15,15 +14,15 @@ let host=${cfg.host} ${lib.optionalString (cfg.groups != "") ("groups=" + cfg.groups)} failmode=${cfg.failmode} - pushinfo=${boolToStr cfg.pushinfo} - autopush=${boolToStr cfg.autopush} + pushinfo=${boolToYesNo cfg.pushinfo} + autopush=${boolToYesNo cfg.autopush} prompts=${toString cfg.prompts} - fallback_local_ip=${boolToStr cfg.fallbackLocalIP} + fallback_local_ip=${boolToYesNo cfg.fallbackLocalIP} ''; configFileLogin = configFilePam + '' - motd=${boolToStr cfg.motd} - accept_env_factor=${boolToStr cfg.acceptEnvFactor} + motd=${boolToYesNo cfg.motd} + accept_env_factor=${boolToYesNo cfg.acceptEnvFactor} ''; in { diff --git a/nixos/modules/security/pam_mount.nix b/nixos/modules/security/pam_mount.nix index 62deec4ca487..d6459c2598f9 100644 --- a/nixos/modules/security/pam_mount.nix +++ b/nixos/modules/security/pam_mount.nix @@ -170,9 +170,7 @@ in - + ${lib.makeBinPath ([ pkgs.util-linux ] ++ cfg.additionalSearchPaths)} diff --git a/nixos/modules/security/tpm2.nix b/nixos/modules/security/tpm2.nix index 29eece1ef794..bc05c75669a3 100644 --- a/nixos/modules/security/tpm2.nix +++ b/nixos/modules/security/tpm2.nix @@ -39,7 +39,7 @@ let ima_log_file = cfg.fapi.imaLogFile; } // lib.optionalAttrs (cfg.fapi.ekCertLess != null) { - ek_cert_less = if cfg.fapi.ekCertLess then "yes" else "no"; + ek_cert_less = lib.boolToYesNo cfg.fapi.ekCertLess; } // lib.optionalAttrs (cfg.fapi.ekFingerprint != null) { ek_fingerprint = cfg.fapi.ekFingerprint; } ) diff --git a/nixos/modules/services/backup/bacula.nix b/nixos/modules/services/backup/bacula.nix index cc2e603bf3f9..45d8557e609d 100644 --- a/nixos/modules/services/backup/bacula.nix +++ b/nixos/modules/services/backup/bacula.nix @@ -10,6 +10,7 @@ let inherit (lib) + boolToYesNo concatStringsSep literalExpression mapAttrsToList @@ -21,16 +22,15 @@ let ; libDir = "/var/lib/bacula"; - yes_no = bool: if bool then "yes" else "no"; tls_conf = tls_cfg: optionalString tls_cfg.enable ( concatStringsSep "\n" ( [ "TLS Enable = yes;" ] - ++ optional (tls_cfg.require != null) "TLS Require = ${yes_no tls_cfg.require};" + ++ optional (tls_cfg.require != null) "TLS Require = ${boolToYesNo tls_cfg.require};" ++ optional (tls_cfg.certificate != null) ''TLS Certificate = "${tls_cfg.certificate}";'' ++ [ ''TLS Key = "${tls_cfg.key}";'' ] - ++ optional (tls_cfg.verifyPeer != null) "TLS Verify Peer = ${yes_no tls_cfg.verifyPeer};" + ++ optional (tls_cfg.verifyPeer != null) "TLS Verify Peer = ${boolToYesNo tls_cfg.verifyPeer};" ++ optional ( tls_cfg.allowedCN != [ ] ) "TLS Allowed CN = ${concatStringsSep " " (tls_cfg.allowedCN)};" diff --git a/nixos/modules/services/databases/cassandra.nix b/nixos/modules/services/databases/cassandra.nix index 27b7a5b94db2..2161fc13ea59 100644 --- a/nixos/modules/services/databases/cassandra.nix +++ b/nixos/modules/services/databases/cassandra.nix @@ -504,7 +504,7 @@ in MAX_HEAP_SIZE = toString cfg.maxHeapSize; HEAP_NEWSIZE = toString cfg.heapNewSize; MALLOC_ARENA_MAX = toString cfg.mallocArenaMax; - LOCAL_JMX = if cfg.remoteJmx then "no" else "yes"; + LOCAL_JMX = lib.boolToYesNo (!cfg.remoteJmx); JMX_PORT = toString cfg.jmxPort; }; wantedBy = [ "multi-user.target" ]; diff --git a/nixos/modules/services/mail/cyrus-imap.nix b/nixos/modules/services/mail/cyrus-imap.nix index 3ffd74451b6c..9ee7cf8ee44b 100644 --- a/nixos/modules/services/mail/cyrus-imap.nix +++ b/nixos/modules/services/mail/cyrus-imap.nix @@ -15,6 +15,7 @@ let optionalString generators mapAttrsToList + boolToYesNo ; inherit (lib.strings) concatStringsSep; inherit (lib.types) @@ -63,7 +64,7 @@ let mkValueString = v: if builtins.isBool v then - if v then "yes" else "no" + boolToYesNo v else if builtins.isList v then concatStringsSep " " v else diff --git a/nixos/modules/services/mail/rspamd.nix b/nixos/modules/services/mail/rspamd.nix index 5b09cfb217fb..715376e24f88 100644 --- a/nixos/modules/services/mail/rspamd.nix +++ b/nixos/modules/services/mail/rspamd.nix @@ -211,9 +211,7 @@ let '' worker "${value.type}" { type = "${value.type}"; - ${optionalString (value.enable != null) - "enabled = ${if value.enable != false then "yes" else "no"};" - } + ${optionalString (value.enable != null) "enabled = ${lib.boolToYesNo (value.enable != false)};"} ${mkBindSockets value.enable value.bindSockets} ${optionalString (value.count != null) "count = ${toString value.count};"} ${concatStringsSep "\n " (map (each: ".include \"${each}\"") value.includes)} diff --git a/nixos/modules/services/misc/gammu-smsd.nix b/nixos/modules/services/misc/gammu-smsd.nix index 85f3d2fa94a9..518a9c4f0065 100644 --- a/nixos/modules/services/misc/gammu-smsd.nix +++ b/nixos/modules/services/misc/gammu-smsd.nix @@ -11,7 +11,7 @@ let [gammu] Device = ${cfg.device.path} Connection = ${cfg.device.connection} - SynchronizeTime = ${if cfg.device.synchronizeTime then "yes" else "no"} + SynchronizeTime = ${lib.boolToYesNo cfg.device.synchronizeTime} LogFormat = ${cfg.log.format} ${lib.optionalString (cfg.device.pin != null) "PIN = ${cfg.device.pin}"} ${cfg.extraConfig.gammu} diff --git a/nixos/modules/services/misc/mediatomb.nix b/nixos/modules/services/misc/mediatomb.nix index eac446817ae7..1b92947db696 100644 --- a/nixos/modules/services/misc/mediatomb.nix +++ b/nixos/modules/services/misc/mediatomb.nix @@ -12,7 +12,6 @@ let opt = options.services.mediatomb; name = cfg.package.pname; pkg = cfg.package; - optionYesNo = option: if option then "yes" else "no"; # configuration on media directory mediaDirectory = { options = { @@ -36,7 +35,7 @@ let }; toMediaDirectory = d: - "\n"; + "\n"; transcodingConfig = if cfg.transcoding then @@ -89,13 +88,13 @@ let ${cfg.dataDir} ${cfg.interface} ${pkg}/share/${name}/web - + ${name}.db - + ${lib.optionalString cfg.dsmSupport '' diff --git a/nixos/modules/services/network-filesystems/orangefs/server.nix b/nixos/modules/services/network-filesystems/orangefs/server.nix index 99d7b27011c2..d3047af4aa91 100644 --- a/nixos/modules/services/network-filesystems/orangefs/server.nix +++ b/nixos/modules/services/network-filesystems/orangefs/server.nix @@ -50,8 +50,8 @@ let - TroveSyncMeta ${if fs.troveSyncMeta then "yes" else "no"} - TroveSyncData ${if fs.troveSyncData then "yes" else "no"} + TroveSyncMeta ${lib.boolToYesNo fs.troveSyncMeta} + TroveSyncData ${lib.boolToYesNo fs.troveSyncData} ${fs.extraStorageHints} diff --git a/nixos/modules/services/networking/avahi-daemon.nix b/nixos/modules/services/networking/avahi-daemon.nix index b1ed28980cfe..28efc39f8bce 100644 --- a/nixos/modules/services/networking/avahi-daemon.nix +++ b/nixos/modules/services/networking/avahi-daemon.nix @@ -7,8 +7,6 @@ let cfg = config.services.avahi; - yesNo = yes: if yes then "yes" else "no"; - avahiDaemonConf = with cfg; pkgs.writeText "avahi-daemon.conf" '' @@ -21,8 +19,8 @@ let lib.optionalString (hostName != "") "host-name=${hostName}" } browse-domains=${lib.concatStringsSep ", " browseDomains} - use-ipv4=${yesNo ipv4} - use-ipv6=${yesNo ipv6} + use-ipv4=${lib.boolToYesNo ipv4} + use-ipv6=${lib.boolToYesNo ipv6} ${lib.optionalString ( allowInterfaces != null ) "allow-interfaces=${lib.concatStringsSep "," allowInterfaces}"} @@ -30,22 +28,22 @@ let denyInterfaces != null ) "deny-interfaces=${lib.concatStringsSep "," denyInterfaces}"} ${lib.optionalString (domainName != null) "domain-name=${domainName}"} - allow-point-to-point=${yesNo allowPointToPoint} + allow-point-to-point=${lib.boolToYesNo allowPointToPoint} ${lib.optionalString (cacheEntriesMax != null) "cache-entries-max=${toString cacheEntriesMax}"} [wide-area] - enable-wide-area=${yesNo wideArea} + enable-wide-area=${lib.boolToYesNo wideArea} [publish] - disable-publishing=${yesNo (!publish.enable)} - disable-user-service-publishing=${yesNo (!publish.userServices)} - publish-addresses=${yesNo (publish.userServices || publish.addresses)} - publish-hinfo=${yesNo publish.hinfo} - publish-workstation=${yesNo publish.workstation} - publish-domain=${yesNo publish.domain} + disable-publishing=${lib.boolToYesNo (!publish.enable)} + disable-user-service-publishing=${lib.boolToYesNo (!publish.userServices)} + publish-addresses=${lib.boolToYesNo (publish.userServices || publish.addresses)} + publish-hinfo=${lib.boolToYesNo publish.hinfo} + publish-workstation=${lib.boolToYesNo publish.workstation} + publish-domain=${lib.boolToYesNo publish.domain} [reflector] - enable-reflector=${yesNo reflector} + enable-reflector=${lib.boolToYesNo reflector} ${extraConfig} ''; in diff --git a/nixos/modules/services/networking/ddclient.nix b/nixos/modules/services/networking/ddclient.nix index 54e488db9856..773387939a7c 100644 --- a/nixos/modules/services/networking/ddclient.nix +++ b/nixos/modules/services/networking/ddclient.nix @@ -6,7 +6,6 @@ }: let cfg = config.services.ddclient; - boolToStr = bool: if bool then "yes" else "no"; dataDir = "/var/lib/ddclient"; StateDirectory = builtins.baseNameOf dataDir; RuntimeDirectory = StateDirectory; @@ -33,10 +32,10 @@ let ${lib.optionalString (cfg.script != "") "script=${cfg.script}"} ${lib.optionalString (cfg.server != "") "server=${cfg.server}"} ${lib.optionalString (cfg.zone != "") "zone=${cfg.zone}"} - ssl=${boolToStr cfg.ssl} + ssl=${lib.boolToYesNo cfg.ssl} wildcard=YES - quiet=${boolToStr cfg.quiet} - verbose=${boolToStr cfg.verbose} + quiet=${lib.boolToYesNo cfg.quiet} + verbose=${lib.boolToYesNo cfg.verbose} ${cfg.extraConfig} ${lib.concatStringsSep "," cfg.domains} ''; diff --git a/nixos/modules/services/networking/frr.nix b/nixos/modules/services/networking/frr.nix index fac18c6a246c..73c194ac060c 100644 --- a/nixos/modules/services/networking/frr.nix +++ b/nixos/modules/services/networking/frr.nix @@ -82,7 +82,7 @@ let isEnabled = service: cfg.${service}.enable; - daemonLine = d: "${d}=${if isEnabled d then "yes" else "no"}"; + daemonLine = d: "${d}=${lib.boolToYesNo (isEnabled d)}"; configFile = if cfg.configFile != null then diff --git a/nixos/modules/services/networking/miniupnpd.nix b/nixos/modules/services/networking/miniupnpd.nix index ccbddbf3d5a1..c723ff16d3cd 100644 --- a/nixos/modules/services/networking/miniupnpd.nix +++ b/nixos/modules/services/networking/miniupnpd.nix @@ -11,8 +11,8 @@ let cfg = config.services.miniupnpd; configFile = pkgs.writeText "miniupnpd.conf" '' ext_ifname=${cfg.externalInterface} - enable_natpmp=${if cfg.natpmp then "yes" else "no"} - enable_upnp=${if cfg.upnp then "yes" else "no"} + enable_natpmp=${boolToYesNo cfg.natpmp} + enable_upnp=${boolToYesNo cfg.upnp} ${concatMapStrings (range: '' listening_ip=${range} diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix index bc6aa5ae3fff..46d9d084d7d7 100644 --- a/nixos/modules/services/networking/nsd.nix +++ b/nixos/modules/services/networking/nsd.nix @@ -100,19 +100,19 @@ let # interfaces ${forEach " ip-address: " cfg.interfaces} - ip-freebind: ${yesOrNo cfg.ipFreebind} - hide-version: ${yesOrNo cfg.hideVersion} + ip-freebind: ${boolToYesNo cfg.ipFreebind} + hide-version: ${boolToYesNo cfg.hideVersion} identity: "${cfg.identity}" - ip-transparent: ${yesOrNo cfg.ipTransparent} - do-ip4: ${yesOrNo cfg.ipv4} + ip-transparent: ${boolToYesNo cfg.ipTransparent} + do-ip4: ${boolToYesNo cfg.ipv4} ipv4-edns-size: ${toString cfg.ipv4EDNSSize} - do-ip6: ${yesOrNo cfg.ipv6} + do-ip6: ${boolToYesNo cfg.ipv6} ipv6-edns-size: ${toString cfg.ipv6EDNSSize} - log-time-ascii: ${yesOrNo cfg.logTimeAscii} + log-time-ascii: ${boolToYesNo cfg.logTimeAscii} ${maybeString "nsid: " cfg.nsid} port: ${toString cfg.port} - reuseport: ${yesOrNo cfg.reuseport} - round-robin: ${yesOrNo cfg.roundRobin} + reuseport: ${boolToYesNo cfg.reuseport} + round-robin: ${boolToYesNo cfg.roundRobin} server-count: ${toString cfg.serverCount} ${maybeToString "statistics: " cfg.statistics} tcp-count: ${toString cfg.tcpCount} @@ -121,7 +121,7 @@ let verbosity: ${toString cfg.verbosity} ${maybeString "version: " cfg.version} xfrd-reload-timeout: ${toString cfg.xfrdReloadTimeout} - zonefiles-check: ${yesOrNo cfg.zonefilesCheck} + zonefiles-check: ${boolToYesNo cfg.zonefilesCheck} zonefiles-write: ${toString cfg.zonefilesWrite} ${maybeString "rrl-ipv4-prefix-length: " cfg.ratelimit.ipv4PrefixLength} @@ -134,7 +134,7 @@ let ${keyConfigFile} remote-control: - control-enable: ${yesOrNo cfg.remoteControl.enable} + control-enable: ${boolToYesNo cfg.remoteControl.enable} control-key-file: "${cfg.remoteControl.controlKeyFile}" control-cert-file: "${cfg.remoteControl.controlCertFile}" ${forEach " control-interface: " cfg.remoteControl.interfaces} @@ -147,7 +147,6 @@ let ${cfg.extraConfig} ''; - yesOrNo = b: if b then "yes" else "no"; maybeString = prefix: x: optionalString (x != null) ''${prefix} "${x}"''; maybeToString = prefix: x: optionalString (x != null) ''${prefix} ${toString x}''; forEach = pre: l: concatMapStrings (x: pre + x + "\n") l; @@ -183,8 +182,8 @@ let ${maybeToString "max-retry-time: " zone.maxRetrySecs} ${maybeToString "min-retry-time: " zone.minRetrySecs} - allow-axfr-fallback: ${yesOrNo zone.allowAXFRFallback} - multi-master-check: ${yesOrNo zone.multiMasterCheck} + allow-axfr-fallback: ${boolToYesNo zone.allowAXFRFallback} + multi-master-check: ${boolToYesNo zone.multiMasterCheck} ${forEach " allow-notify: " zone.allowNotify} ${forEach " request-xfr: " zone.requestXFR} diff --git a/nixos/modules/services/networking/pdns-recursor.nix b/nixos/modules/services/networking/pdns-recursor.nix index 3185dd1b9696..172f45c61331 100644 --- a/nixos/modules/services/networking/pdns-recursor.nix +++ b/nixos/modules/services/networking/pdns-recursor.nix @@ -21,7 +21,6 @@ let ]; configType = with types; attrsOf (nullOr (oneOrMore valueType)); - toBool = val: if val then "yes" else "no"; serialize = val: with types; @@ -32,7 +31,7 @@ let else if path.check val then toString val else if bool.check val then - toBool val + boolToYesNo val else if builtins.isList val then (concatMapStringsSep "," serialize val) else diff --git a/nixos/modules/services/networking/smartdns.nix b/nixos/modules/services/networking/smartdns.nix index d60c5cf19b84..761f3c3e6a14 100644 --- a/nixos/modules/services/networking/smartdns.nix +++ b/nixos/modules/services/networking/smartdns.nix @@ -23,7 +23,7 @@ let with generators; toKeyValue { mkKeyValue = mkKeyValueDefault { - mkValueString = v: if isBool v then if v then "yes" else "no" else mkValueStringDefault { } v; + mkValueString = v: if isBool v then boolToYesNo v else mkValueStringDefault { } v; } " "; listsAsDuplicateKeys = true; # Allowing duplications because we need to deal with multiple entries with the same key. } cfg.settings diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index c56193cb4f83..ac7d43f81e77 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -484,7 +484,6 @@ in }; UseDns = lib.mkOption { type = lib.types.nullOr lib.types.bool; - # apply if cfg.useDns then "yes" else "no" default = false; description = '' Specifies whether {manpage}`sshd(8)` should look up the remote host name, and to check that the resolved host name for diff --git a/nixos/modules/services/networking/strongswan-swanctl/param-constructors.nix b/nixos/modules/services/networking/strongswan-swanctl/param-constructors.nix index cb4ef1079016..82b38d18c639 100644 --- a/nixos/modules/services/networking/strongswan-swanctl/param-constructors.nix +++ b/nixos/modules/services/networking/strongswan-swanctl/param-constructors.nix @@ -97,7 +97,7 @@ rec { default = null; description = documentDefault description strongswanDefault; }; - render = single (b: if b then "yes" else "no"); + render = single boolToYesNo; }; yes = true; no = false; diff --git a/nixos/modules/services/networking/stunnel.nix b/nixos/modules/services/networking/stunnel.nix index 9ff040191361..9ce2451b4231 100644 --- a/nixos/modules/services/networking/stunnel.nix +++ b/nixos/modules/services/networking/stunnel.nix @@ -7,7 +7,6 @@ let cfg = config.services.stunnel; - yesNo = val: if val then "yes" else "no"; verifyRequiredField = type: field: n: c: { assertion = lib.hasAttr field c; @@ -23,13 +22,7 @@ let removeNulls = lib.mapAttrs (_: lib.filterAttrs (_: v: v != null)); mkValueString = - v: - if v == true then - "yes" - else if v == false then - "no" - else - lib.generators.mkValueStringDefault { } v; + v: if lib.isBool v then lib.boolToYesNo v else lib.generators.mkValueStringDefault { } v; generateConfig = c: lib.generators.toINI { diff --git a/nixos/modules/services/networking/tayga.nix b/nixos/modules/services/networking/tayga.nix index 7ed0cf51e561..f7221bdaf8c7 100644 --- a/nixos/modules/services/networking/tayga.nix +++ b/nixos/modules/services/networking/tayga.nix @@ -28,7 +28,7 @@ let log ${concatStringsSep " " cfg.log} ''} - wkpf-strict ${if cfg.wkpfStrict then "yes" else "no"} + wkpf-strict ${boolToYesNo cfg.wkpfStrict} ''; addrOpts = diff --git a/nixos/modules/services/networking/unbound.nix b/nixos/modules/services/networking/unbound.nix index 7ad0c53c17e9..219ca9fc13a9 100644 --- a/nixos/modules/services/networking/unbound.nix +++ b/nixos/modules/services/networking/unbound.nix @@ -9,8 +9,6 @@ with lib; let cfg = config.services.unbound; - yesOrNo = v: if v then "yes" else "no"; - toOption = indent: n: v: "${indent}${toString n}: ${v}"; @@ -22,7 +20,7 @@ let else if isInt v then (toOption indent n (toString v)) else if isBool v then - (toOption indent n (yesOrNo v)) + (toOption indent n (lib.boolToYesNo v)) else if isString v then (toOption indent n v) else if isList v then diff --git a/nixos/modules/services/networking/xinetd.nix b/nixos/modules/services/networking/xinetd.nix index 71a258fbfee1..d33b4d97519b 100644 --- a/nixos/modules/services/networking/xinetd.nix +++ b/nixos/modules/services/networking/xinetd.nix @@ -31,7 +31,7 @@ let ${optionalString (srv.flags != "") "flags = ${srv.flags}"} socket_type = ${if srv.protocol == "udp" then "dgram" else "stream"} ${optionalString (srv.port != 0) "port = ${toString srv.port}"} - wait = ${if srv.protocol == "udp" then "yes" else "no"} + wait = ${lib.boolToYesNo (srv.protocol == "udp")} user = ${srv.user} server = ${srv.server} ${optionalString (srv.serverArgs != "") "server_args = ${srv.serverArgs}"} diff --git a/nixos/modules/tasks/network-interfaces-systemd.nix b/nixos/modules/tasks/network-interfaces-systemd.nix index 653fafb9b216..14f9108c160d 100644 --- a/nixos/modules/tasks/network-interfaces-systemd.nix +++ b/nixos/modules/tasks/network-interfaces-systemd.nix @@ -18,7 +18,7 @@ let interfaceRoutes = i: i.ipv4.routes ++ optionals cfg.enableIPv6 i.ipv6.routes; - dhcpStr = useDHCP: if useDHCP == true || useDHCP == null then "yes" else "no"; + dhcpStr = useDHCP: boolToYesNo (useDHCP == true || useDHCP == null); slaves = concatLists (map (bond: bond.interfaces) (attrValues cfg.bonds)) diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix index 6ac94dc2906b..aec14488480b 100644 --- a/pkgs/applications/misc/redshift/default.nix +++ b/pkgs/applications/misc/redshift/default.nix @@ -70,12 +70,12 @@ let ++ lib.optionals (pname == "gammastep") [ wayland-scanner ]; configureFlags = [ - "--enable-randr=${if withRandr then "yes" else "no"}" - "--enable-geoclue2=${if withGeoclue then "yes" else "no"}" - "--enable-drm=${if withDrm then "yes" else "no"}" - "--enable-vidmode=${if withVidmode then "yes" else "no"}" - "--enable-quartz=${if withQuartz then "yes" else "no"}" - "--enable-corelocation=${if withCoreLocation then "yes" else "no"}" + "--enable-randr=${lib.boolToYesNo withRandr}" + "--enable-geoclue2=${lib.boolToYesNo withGeoclue}" + "--enable-drm=${lib.boolToYesNo withDrm}" + "--enable-vidmode=${lib.boolToYesNo withVidmode}" + "--enable-quartz=${lib.boolToYesNo withQuartz}" + "--enable-corelocation=${lib.boolToYesNo withCoreLocation}" ] ++ lib.optionals (pname == "gammastep") [ "--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user/" diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix index 27afc3a117fa..2359587665b8 100644 --- a/pkgs/build-support/release/debian-build.nix +++ b/pkgs/build-support/release/debian-build.nix @@ -69,7 +69,7 @@ vmTools.runInLinuxImage ( # the log file export PAGER=cat ${checkinstall}/sbin/checkinstall --nodoc -y -D \ - --fstrans=${if fsTranslation then "yes" else "no"} \ + --fstrans=${lib.boolToYesNo fsTranslation} \ --requires="${lib.concatStringsSep "," debRequires}" \ --provides="${lib.concatStringsSep "," debProvides}" \ ${ diff --git a/pkgs/by-name/ap/apr/package.nix b/pkgs/by-name/ap/apr/package.nix index 8ded7258aca7..f9feea54a782 100644 --- a/pkgs/by-name/ap/apr/package.nix +++ b/pkgs/by-name/ap/apr/package.nix @@ -40,7 +40,7 @@ stdenv.mkDerivation rec { # These answers are valid on x86_64-linux and aarch64-linux. # TODO: provide all valid answers for BSD. "ac_cv_file__dev_zero=yes" - "ac_cv_func_setpgrp_void=${if stdenv.hostPlatform.isBSD then "no" else "yes"}" + "ac_cv_func_setpgrp_void=${lib.boolToYesNo (!stdenv.hostPlatform.isBSD)}" "apr_cv_tcp_nodelay_with_cork=yes" "ac_cv_define_PTHREAD_PROCESS_SHARED=yes" "apr_cv_process_shared_works=yes" diff --git a/pkgs/by-name/ba/bacula/package.nix b/pkgs/by-name/ba/bacula/package.nix index 74007248fd63..9397eab8c4dd 100644 --- a/pkgs/by-name/ba/bacula/package.nix +++ b/pkgs/by-name/ba/bacula/package.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { ] ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) - "ac_cv_func_setpgrp_void=${if stdenv.hostPlatform.isBSD then "no" else "yes"}" + "ac_cv_func_setpgrp_void=${lib.boolToYesNo (!stdenv.hostPlatform.isBSD)}" ++ lib.optionals stdenv.hostPlatform.isDarwin [ # bacula’s `configure` script fails to detect CoreFoundation correctly, # but these symbols are available in the nixpkgs CoreFoundation framework. diff --git a/pkgs/by-name/co/colpack/package.nix b/pkgs/by-name/co/colpack/package.nix index 897b137cd2c9..56bb94293a0e 100644 --- a/pkgs/by-name/co/colpack/package.nix +++ b/pkgs/by-name/co/colpack/package.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook ]; configureFlags = [ - "--enable-openmp=${if stdenv.hostPlatform.isLinux then "yes" else "no"}" + "--enable-openmp=${lib.boolToYesNo stdenv.hostPlatform.isLinux}" "--enable-examples=no" ]; diff --git a/pkgs/by-name/do/dovecot/package.nix b/pkgs/by-name/do/dovecot/package.nix index 1dce4874455d..5dd75ba1b615 100644 --- a/pkgs/by-name/do/dovecot/package.nix +++ b/pkgs/by-name/do/dovecot/package.nix @@ -155,9 +155,9 @@ stdenv.mkDerivation rec { "--with-textcat" ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "i_cv_epoll_works=${if stdenv.hostPlatform.isLinux then "yes" else "no"}" - "i_cv_posix_fallocate_works=${if stdenv.hostPlatform.isDarwin then "no" else "yes"}" - "i_cv_inotify_works=${if stdenv.hostPlatform.isLinux then "yes" else "no"}" + "i_cv_epoll_works=${lib.boolToYesNo stdenv.hostPlatform.isLinux}" + "i_cv_posix_fallocate_works=${lib.boolToYesNo stdenv.hostPlatform.isDarwin}" + "i_cv_inotify_works=${lib.boolToYesNo stdenv.hostPlatform.isLinux}" "i_cv_signed_size_t=no" "i_cv_signed_time_t=yes" "i_cv_c99_vsnprintf=yes" diff --git a/pkgs/by-name/i2/i2pd/package.nix b/pkgs/by-name/i2/i2pd/package.nix index 598ffdc52936..83b9fa9aa0cb 100644 --- a/pkgs/by-name/i2/i2pd/package.nix +++ b/pkgs/by-name/i2/i2pd/package.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { ]; makeFlags = [ - "USE_UPNP=${if upnpSupport then "yes" else "no"}" + "USE_UPNP=${lib.boolToYesNo upnpSupport}" ]; enableParallelBuilding = true; diff --git a/pkgs/by-name/li/libcap/package.nix b/pkgs/by-name/li/libcap/package.nix index 7abcdb8d24b8..76e0ee1d0fe6 100644 --- a/pkgs/by-name/li/libcap/package.nix +++ b/pkgs/by-name/li/libcap/package.nix @@ -56,7 +56,7 @@ stdenv.mkDerivation rec { makeFlags = [ "lib=lib" - "PAM_CAP=${if usePam then "yes" else "no"}" + "PAM_CAP=${lib.boolToYesNo usePam}" "BUILD_CC=$(CC_FOR_BUILD)" "CC:=$(CC)" "CROSS_COMPILE=${stdenv.cc.targetPrefix}" diff --git a/pkgs/by-name/li/libdaemon/package.nix b/pkgs/by-name/li/libdaemon/package.nix index 7be36bcece73..5a2013bfe03c 100644 --- a/pkgs/by-name/li/libdaemon/package.nix +++ b/pkgs/by-name/li/libdaemon/package.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ # Can't run this test while cross-compiling - "ac_cv_func_setpgrp_void=${if stdenv.hostPlatform.isBSD then "no" else "yes"}" + "ac_cv_func_setpgrp_void=${lib.boolToYesNo (!stdenv.hostPlatform.isBSD)}" ]; meta = { diff --git a/pkgs/by-name/li/libepoxy/package.nix b/pkgs/by-name/li/libepoxy/package.nix index c408b12bac40..c73090a25a29 100644 --- a/pkgs/by-name/li/libepoxy/package.nix +++ b/pkgs/by-name/li/libepoxy/package.nix @@ -63,8 +63,8 @@ stdenv.mkDerivation (finalAttrs: { ]; mesonFlags = [ - "-Degl=${if (x11Support && !stdenv.hostPlatform.isDarwin) then "yes" else "no"}" - "-Dglx=${if x11Support then "yes" else "no"}" + "-Degl=${lib.boolToYesNo (x11Support && !stdenv.hostPlatform.isDarwin)}" + "-Dglx=${lib.boolToYesNo x11Support}" "-Dtests=${lib.boolToString finalAttrs.finalPackage.doCheck}" "-Dx11=${lib.boolToString x11Support}" ]; diff --git a/pkgs/by-name/li/libgpiod/package.nix b/pkgs/by-name/li/libgpiod/package.nix index b40cb39b86ff..ed6b3ca2fa1c 100644 --- a/pkgs/by-name/li/libgpiod/package.nix +++ b/pkgs/by-name/li/libgpiod/package.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { ]; configureFlags = [ - "--enable-tools=${if enable-tools then "yes" else "no"}" + "--enable-tools=${lib.boolToYesNo enable-tools}" "--enable-bindings-cxx" ]; diff --git a/pkgs/by-name/li/libgpiod_1/package.nix b/pkgs/by-name/li/libgpiod_1/package.nix index f1c4908a2683..39aa5b933d01 100644 --- a/pkgs/by-name/li/libgpiod_1/package.nix +++ b/pkgs/by-name/li/libgpiod_1/package.nix @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { ]; configureFlags = [ - "--enable-tools=${if enable-tools then "yes" else "no"}" + "--enable-tools=${lib.boolToYesNo enable-tools}" "--enable-bindings-cxx" "--prefix=${placeholder "out"}" ] diff --git a/pkgs/by-name/mo/moc/package.nix b/pkgs/by-name/mo/moc/package.nix index ee093e43eb4c..676b435661ba 100644 --- a/pkgs/by-name/mo/moc/package.nix +++ b/pkgs/by-name/mo/moc/package.nix @@ -147,7 +147,7 @@ stdenv.mkDerivation { # Misc (lib.withFeature curlSupport "curl") (lib.withFeature samplerateSupport "samplerate") - ("--enable-debug=" + (if withDebug then "yes" else "no")) + "--enable-debug=${lib.boolToYesNo withDebug}" "--disable-cache" "--without-rcc" ]; diff --git a/pkgs/by-name/mo/motif/package.nix b/pkgs/by-name/mo/motif/package.nix index c06b6c1e062c..92bd4eafae1b 100644 --- a/pkgs/by-name/mo/motif/package.nix +++ b/pkgs/by-name/mo/motif/package.nix @@ -119,7 +119,7 @@ stdenv.mkDerivation rec { # provide correct configure answers for cross builds configureFlags = [ - "ac_cv_func_setpgrp_void=${if stdenv.hostPlatform.isBSD then "no" else "yes"}" + "ac_cv_func_setpgrp_void=${lib.boolToYesNo (!stdenv.hostPlatform.isBSD)}" ]; env = lib.optionalAttrs stdenv.cc.isClang { diff --git a/pkgs/by-name/mu/mupdf/package.nix b/pkgs/by-name/mu/mupdf/package.nix index 1d3b8cea5f99..82447b34a4c5 100644 --- a/pkgs/by-name/mu/mupdf/package.nix +++ b/pkgs/by-name/mu/mupdf/package.nix @@ -282,7 +282,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - env.USE_SONAME = if (stdenv.hostPlatform.isDarwin) then "no" else "yes"; + env.USE_SONAME = lib.boolToYesNo (!stdenv.hostPlatform.isDarwin); passthru = { tests = { diff --git a/pkgs/by-name/ne/networkmanager-fortisslvpn/package.nix b/pkgs/by-name/ne/networkmanager-fortisslvpn/package.nix index c03e224044a2..578632ad42b3 100644 --- a/pkgs/by-name/ne/networkmanager-fortisslvpn/package.nix +++ b/pkgs/by-name/ne/networkmanager-fortisslvpn/package.nix @@ -63,8 +63,8 @@ stdenv.mkDerivation rec { ]; configureFlags = [ - "--with-gnome=${if withGnome then "yes" else "no"}" - "--with-gtk4=${if withGnome then "yes" else "no"}" + "--with-gnome=${lib.boolToYesNo withGnome}" + "--with-gtk4=${lib.boolToYesNo withGnome}" "--localstatedir=/var" "--enable-absolute-paths" ]; diff --git a/pkgs/by-name/ne/networkmanager-iodine/package.nix b/pkgs/by-name/ne/networkmanager-iodine/package.nix index 423a68a9392b..c32c8d3ac34d 100644 --- a/pkgs/by-name/ne/networkmanager-iodine/package.nix +++ b/pkgs/by-name/ne/networkmanager-iodine/package.nix @@ -53,7 +53,7 @@ stdenv.mkDerivation { ]; configureFlags = [ - "--with-gnome=${if withGnome then "yes" else "no"}" + "--with-gnome=${lib.boolToYesNo withGnome}" "--localstatedir=/" # needed for the management socket under /run/NetworkManager "--enable-absolute-paths" ]; diff --git a/pkgs/by-name/ne/networkmanager-l2tp/package.nix b/pkgs/by-name/ne/networkmanager-l2tp/package.nix index ddb1a9ea489d..3b2a3830d5de 100644 --- a/pkgs/by-name/ne/networkmanager-l2tp/package.nix +++ b/pkgs/by-name/ne/networkmanager-l2tp/package.nix @@ -62,8 +62,8 @@ stdenv.mkDerivation rec { ]; configureFlags = [ - "--with-gnome=${if withGnome then "yes" else "no"}" - "--with-gtk4=${if withGnome then "yes" else "no"}" + "--with-gnome=${lib.boolToYesNo withGnome}" + "--with-gtk4=${lib.boolToYesNo withGnome}" "--localstatedir=/var" "--enable-absolute-paths" ]; diff --git a/pkgs/by-name/ne/networkmanager-openconnect/package.nix b/pkgs/by-name/ne/networkmanager-openconnect/package.nix index 2fa483df360e..d9bf1c519342 100644 --- a/pkgs/by-name/ne/networkmanager-openconnect/package.nix +++ b/pkgs/by-name/ne/networkmanager-openconnect/package.nix @@ -60,8 +60,8 @@ stdenv.mkDerivation rec { ]; configureFlags = [ - "--with-gnome=${if withGnome then "yes" else "no"}" - "--with-gtk4=${if withGnome then "yes" else "no"}" + "--with-gnome=${lib.boolToYesNo withGnome}" + "--with-gtk4=${lib.boolToYesNo withGnome}" "--enable-absolute-paths" ]; diff --git a/pkgs/by-name/ne/networkmanager-openvpn/package.nix b/pkgs/by-name/ne/networkmanager-openvpn/package.nix index fc777d2e7a77..8ea6dd63f8db 100644 --- a/pkgs/by-name/ne/networkmanager-openvpn/package.nix +++ b/pkgs/by-name/ne/networkmanager-openvpn/package.nix @@ -56,8 +56,8 @@ stdenv.mkDerivation (finalAttrs: { ]; configureFlags = [ - "--with-gnome=${if withGnome then "yes" else "no"}" - "--with-gtk4=${if withGnome then "yes" else "no"}" + "--with-gnome=${lib.boolToYesNo withGnome}" + "--with-gtk4=${lib.boolToYesNo withGnome}" "--localstatedir=/" # needed for the management socket under /run/NetworkManager "--enable-absolute-paths" ]; diff --git a/pkgs/by-name/ne/networkmanager-sstp/package.nix b/pkgs/by-name/ne/networkmanager-sstp/package.nix index fb44c80c5e31..b881ddf0c756 100644 --- a/pkgs/by-name/ne/networkmanager-sstp/package.nix +++ b/pkgs/by-name/ne/networkmanager-sstp/package.nix @@ -59,8 +59,8 @@ stdenv.mkDerivation rec { ''; configureFlags = [ - "--with-gnome=${if withGnome then "yes" else "no"}" - "--with-gtk4=${if withGnome then "yes" else "no"}" + "--with-gnome=${lib.boolToYesNo withGnome}" + "--with-gtk4=${lib.boolToYesNo withGnome}" "--with-pppd-plugin-dir=$(out)/lib/pppd/2.5.0" "--enable-absolute-paths" ]; diff --git a/pkgs/by-name/ne/networkmanager-vpnc/package.nix b/pkgs/by-name/ne/networkmanager-vpnc/package.nix index e5eab9609e70..06c49313d36e 100644 --- a/pkgs/by-name/ne/networkmanager-vpnc/package.nix +++ b/pkgs/by-name/ne/networkmanager-vpnc/package.nix @@ -52,8 +52,8 @@ stdenv.mkDerivation rec { ]; configureFlags = [ - "--with-gnome=${if withGnome then "yes" else "no"}" - "--with-gtk4=${if withGnome then "yes" else "no"}" + "--with-gnome=${lib.boolToYesNo withGnome}" + "--with-gtk4=${lib.boolToYesNo withGnome}" "--enable-absolute-paths" ]; diff --git a/pkgs/by-name/op/openmpi/package.nix b/pkgs/by-name/op/openmpi/package.nix index 2984c4c035d9..4bd744c5f5d3 100644 --- a/pkgs/by-name/op/openmpi/package.nix +++ b/pkgs/by-name/op/openmpi/package.nix @@ -58,7 +58,7 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace configure \ --replace-fail \ ompi_cv_op_avx_check_${option}=yes \ - ompi_cv_op_avx_check_${option}=${if val then "yes" else "no"} + ompi_cv_op_avx_check_${option}=${lib.boolToYesNo val} '' )) (lib.concatStringsSep "\n") diff --git a/pkgs/by-name/pc/pciutils/package.nix b/pkgs/by-name/pc/pciutils/package.nix index 3aa99cd6634a..b3a0d2b91357 100644 --- a/pkgs/by-name/pc/pciutils/package.nix +++ b/pkgs/by-name/pc/pciutils/package.nix @@ -36,7 +36,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; makeFlags = [ - "SHARED=${if static then "no" else "yes"}" + "SHARED=${lib.boolToYesNo (!static)}" "PREFIX=\${out}" "STRIP=" "HOST=${stdenv.hostPlatform.system}" diff --git a/pkgs/by-name/sh/shadow/package.nix b/pkgs/by-name/sh/shadow/package.nix index 719bfb4fb1ff..72681d81eae0 100644 --- a/pkgs/by-name/sh/shadow/package.nix +++ b/pkgs/by-name/sh/shadow/package.nix @@ -86,7 +86,7 @@ stdenv.mkDerivation rec { # `AC_FUNC_SETPGRP' is not cross-compilation capable. preConfigure = '' - export ac_cv_func_setpgrp_void=${if stdenv.hostPlatform.isBSD then "no" else "yes"} + export ac_cv_func_setpgrp_void=${lib.boolToYesNo (!stdenv.hostPlatform.isBSD)} export shadow_cv_logdir=/var/log ''; diff --git a/pkgs/by-name/tp/tpm2-pkcs11/package.nix b/pkgs/by-name/tp/tpm2-pkcs11/package.nix index 233f578d6596..aa5c17d283aa 100644 --- a/pkgs/by-name/tp/tpm2-pkcs11/package.nix +++ b/pkgs/by-name/tp/tpm2-pkcs11/package.nix @@ -87,7 +87,7 @@ chosenStdenv.mkDerivation (finalAttrs: { (lib.enableFeature finalAttrs.doCheck "integration") # Strangely, it uses --with-fapi=yes|no instead of a normal configure flag. - "--with-fapi=${if fapiSupport then "yes" else "no"}" + "--with-fapi=${lib.boolToYesNo fapiSupport}" ] ++ lib.optionals enableFuzzing [ "--enable-fuzzing" diff --git a/pkgs/by-name/w3/w3m/package.nix b/pkgs/by-name/w3/w3m/package.nix index 4cb3648a56c5..c9d00588502a 100644 --- a/pkgs/by-name/w3/w3m/package.nix +++ b/pkgs/by-name/w3/w3m/package.nix @@ -110,7 +110,7 @@ stdenv.mkDerivation (finalAttrs: { "CFLAGS=-std=gnu17" ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ - "ac_cv_func_setpgrp_void=${if stdenv.hostPlatform.isBSD then "no" else "yes"}" + "ac_cv_func_setpgrp_void=${lib.boolToYesNo (!stdenv.hostPlatform.isBSD)}" ] ++ lib.optional graphicsSupport "--enable-image=${lib.optionalString x11Support "x11,"}fb" ++ lib.optional (graphicsSupport && !x11Support) "--without-x"; diff --git a/pkgs/development/ada-modules/gnatcoll/core.nix b/pkgs/development/ada-modules/gnatcoll/core.nix index 6cd55e28c0bb..015c2e54e276 100644 --- a/pkgs/development/ada-modules/gnatcoll/core.nix +++ b/pkgs/development/ada-modules/gnatcoll/core.nix @@ -63,8 +63,8 @@ stdenv.mkDerivation rec { "PROCESSORS=$(NIX_BUILD_CORES)" # confusingly, for gprbuild --target is autoconf --host "TARGET=${stdenv.hostPlatform.config}" - "GNATCOLL_MINIMAL_ONLY=${if !enableGnatcollCore then "yes" else "no"}" - "GNATCOLL_PROJECTS=${if enableGnatcollProjects then "yes" else "no"}" + "GNATCOLL_MINIMAL_ONLY=${lib.boolToYesNo (!enableGnatcollCore)}" + "GNATCOLL_PROJECTS=${lib.boolToYesNo enableGnatcollProjects}" ]; passthru.tests = { diff --git a/pkgs/development/ada-modules/gpr2/default.nix b/pkgs/development/ada-modules/gpr2/default.nix index 11c6006884f5..7448d251a692 100644 --- a/pkgs/development/ada-modules/gpr2/default.nix +++ b/pkgs/development/ada-modules/gpr2/default.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { makeFlags = [ "prefix=$(out)" "PROCESSORS=$(NIX_BUILD_CORES)" - "ENABLE_SHARED=${if enableShared then "yes" else "no"}" + "ENABLE_SHARED=${lib.boolToYesNo enableShared}" "GPR2_BUILD=release" ] ++ lib.optionals (gpr2kbdir != null) [ diff --git a/pkgs/development/ada-modules/gprbuild/default.nix b/pkgs/development/ada-modules/gprbuild/default.nix index b6f4a32fb441..c8d530466ca7 100644 --- a/pkgs/development/ada-modules/gprbuild/default.nix +++ b/pkgs/development/ada-modules/gprbuild/default.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation { ]; makeFlags = [ - "ENABLE_SHARED=${if stdenv.hostPlatform.isStatic then "no" else "yes"}" + "ENABLE_SHARED=${lib.boolToYesNo (!stdenv.hostPlatform.isStatic)}" "PROCESSORS=$(NIX_BUILD_CORES)" # confusingly, for gprbuild --target is autoconf --host "TARGET=${stdenv.hostPlatform.config}" diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 58a2a5c4e2e6..51f9a544146c 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -516,8 +516,8 @@ stdenv.mkDerivation (finalAttrs: { "ac_cv_have_size_t_format=yes" "ac_cv_computed_gotos=yes" # Both fail when building for windows, normally configure checks this by itself but on other platforms this is set to yes always. - "ac_cv_file__dev_ptmx=${if stdenv.hostPlatform.isWindows then "no" else "yes"}" - "ac_cv_file__dev_ptc=${if stdenv.hostPlatform.isWindows then "no" else "yes"}" + "ac_cv_file__dev_ptmx=${lib.boolToYesNo (!stdenv.hostPlatform.isWindows)}" + "ac_cv_file__dev_ptc=${lib.boolToYesNo (!stdenv.hostPlatform.isWindows)}" ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform && pythonAtLeast "3.11") [ "--with-build-python=${pythonOnBuildForHostInterpreter}" diff --git a/pkgs/development/libraries/libgda/5.x.nix b/pkgs/development/libraries/libgda/5.x.nix index 0761542379d3..ff40c3ccf86e 100644 --- a/pkgs/development/libraries/libgda/5.x.nix +++ b/pkgs/development/libraries/libgda/5.x.nix @@ -78,15 +78,15 @@ stdenv.mkDerivation rec { ]; configureFlags = [ - "--with-mysql=${if mysqlSupport then "yes" else "no"}" - "--with-postgres=${if postgresSupport then "yes" else "no"}" + "--with-mysql=${lib.boolToYesNo mysqlSupport}" + "--with-postgres=${lib.boolToYesNo postgresSupport}" # macOS builds use the sqlite source code that comes with libgda, # as opposed to using the system or brewed sqlite3, which is not supported on macOS, # as mentioned in https://github.com/GNOME/libgda/blob/95eeca4b0470f347c645a27f714c62aa6e59f820/libgda/sqlite/README#L31, # which references the paper https://web.archive.org/web/20100610151539/http://lattice.umiacs.umd.edu/files/functions_tr.pdf # See also https://github.com/Homebrew/homebrew-core/blob/104f9ecd02854a82372b64d63d41356555378a52/Formula/libgda.rb - "--enable-system-sqlite=${if stdenv.hostPlatform.isDarwin then "no" else "yes"}" + "--enable-system-sqlite=${lib.boolToYesNo (!stdenv.hostPlatform.isDarwin)}" ]; env.NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types"; diff --git a/pkgs/development/tools/protoc-gen-grpc-web/default.nix b/pkgs/development/tools/protoc-gen-grpc-web/default.nix index 61e9c252c12c..357d1d9a7272 100644 --- a/pkgs/development/tools/protoc-gen-grpc-web/default.nix +++ b/pkgs/development/tools/protoc-gen-grpc-web/default.nix @@ -26,7 +26,7 @@ stdenv.mkDerivation (finalAttrs: { makeFlags = [ "PREFIX=$(out)" - "STATIC=${if isStatic then "yes" else "no"}" + "STATIC=${lib.boolToYesNo isStatic}" ]; doCheck = true; diff --git a/pkgs/games/quake2/yquake2/default.nix b/pkgs/games/quake2/yquake2/default.nix index 749147859273..1646cb3163c3 100644 --- a/pkgs/games/quake2/yquake2/default.nix +++ b/pkgs/games/quake2/yquake2/default.nix @@ -14,8 +14,6 @@ }: let - mkFlag = b: if b then "yes" else "no"; - games = import ./games.nix { inherit stdenv lib fetchFromGitHub; }; wrapper = import ./wrapper.nix { @@ -58,7 +56,7 @@ let ++ lib.optional openalSupport openal; makeFlags = [ - "WITH_OPENAL=${mkFlag openalSupport}" + "WITH_OPENAL=${lib.boolToYesNo openalSupport}" "WITH_SYSTEMWIDE=yes" "WITH_SYSTEMDIR=$\{out}/share/games/quake2" ]; diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/sys/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/sys/package.nix index 9c93d416f6c0..3dbfe3d9c284 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/sys/package.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/sys/package.nix @@ -70,7 +70,7 @@ let // (lib.flip lib.mapAttrs' extraFlags ( name: value: { name = "MK_${lib.toUpper name}"; - value = if value then "yes" else "no"; + value = lib.boolToYesNo value; } )); in diff --git a/pkgs/shells/bash/5.nix b/pkgs/shells/bash/5.nix index 08b4e4bff2fc..0ca4ca768b5d 100644 --- a/pkgs/shells/bash/5.nix +++ b/pkgs/shells/bash/5.nix @@ -103,7 +103,7 @@ lib.warnIf (withDocs != null) # default is fine for static linking on Linux (weak symbols?) but # not with BSDs, when it does clash with the regular `getenv`. "bash_cv_getenv_redef=${ - if !(with stdenv.hostPlatform; isStatic && (isOpenBSD || isFreeBSD)) then "yes" else "no" + lib.boolToYesNo (!(with stdenv.hostPlatform; isStatic && (isOpenBSD || isFreeBSD))) }" ] ++ lib.optionals stdenv.hostPlatform.isCygwin [ diff --git a/pkgs/tools/nix/info/default.nix b/pkgs/tools/nix/info/default.nix index be5b75282101..00e6821ce7bd 100644 --- a/pkgs/tools/nix/info/default.nix +++ b/pkgs/tools/nix/info/default.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation { ] ++ (lib.optionals stdenv.hostPlatform.isDarwin [ darwin.DarwinTools ]) ); - is_darwin = if stdenv.hostPlatform.isDarwin then "yes" else "no"; + is_darwin = lib.boolToYesNo stdenv.hostPlatform.isDarwin; sandboxtest = ./sandbox.nix; relaxedsandboxtest = ./relaxedsandbox.nix;