lol

Merge pull request #24830 from mayflower/refactor/boolToString

treewide: use boolToString function

authored by

Daniel Peebles and committed by
GitHub
09a9a472 c9ba3911

+111 -118
+5
lib/trivial.nix
··· 30 30 /* boolean “and” */ 31 31 and = x: y: x && y; 32 32 33 + /* Convert a boolean to a string. 34 + Note that toString on a bool returns "1" and "". 35 + */ 36 + boolToString = b: if b then "true" else "false"; 37 + 33 38 /* Merge two attribute sets shallowly, right side trumps left 34 39 35 40 Example:
+1 -1
nixos/modules/config/fonts/fontconfig-penultimate.nix
··· 5 5 let 6 6 cfg = config.fonts.fontconfig; 7 7 8 - fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>"; 8 + fcBool = x: "<bool>" + (boolToString x) + "</bool>"; 9 9 10 10 # back-supported fontconfig version and package 11 11 # version is used for font cache generation
+1 -1
nixos/modules/config/fonts/fontconfig.nix
··· 20 20 21 21 let cfg = config.fonts.fontconfig; 22 22 23 - fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>"; 23 + fcBool = x: "<bool>" + (boolToString x) + "</bool>"; 24 24 25 25 # back-supported fontconfig version and package 26 26 # version is used for font cache generation
+7 -7
nixos/modules/services/cluster/kubernetes.nix
··· 612 612 --require-kubeconfig \ 613 613 --address=${cfg.kubelet.address} \ 614 614 --port=${toString cfg.kubelet.port} \ 615 - --register-node=${if cfg.kubelet.registerNode then "true" else "false"} \ 616 - --register-schedulable=${if cfg.kubelet.registerSchedulable then "true" else "false"} \ 615 + --register-node=${boolToString cfg.kubelet.registerNode} \ 616 + --register-schedulable=${boolToString cfg.kubelet.registerSchedulable} \ 617 617 ${optionalString (cfg.kubelet.tlsCertFile != null) 618 618 "--tls-cert-file=${cfg.kubelet.tlsCertFile}"} \ 619 619 ${optionalString (cfg.kubelet.tlsKeyFile != null) ··· 621 621 --healthz-bind-address=${cfg.kubelet.healthz.bind} \ 622 622 --healthz-port=${toString cfg.kubelet.healthz.port} \ 623 623 --hostname-override=${cfg.kubelet.hostname} \ 624 - --allow-privileged=${if cfg.kubelet.allowPrivileged then "true" else "false"} \ 624 + --allow-privileged=${boolToString cfg.kubelet.allowPrivileged} \ 625 625 --root-dir=${cfg.dataDir} \ 626 626 --cadvisor_port=${toString cfg.kubelet.cadvisorPort} \ 627 627 ${optionalString (cfg.kubelet.clusterDns != "") ··· 670 670 --bind-address=0.0.0.0 \ 671 671 ${optionalString (cfg.apiserver.advertiseAddress != null) 672 672 "--advertise-address=${cfg.apiserver.advertiseAddress}"} \ 673 - --allow-privileged=${if cfg.apiserver.allowPrivileged then "true" else "false"} \ 673 + --allow-privileged=${boolToString cfg.apiserver.allowPrivileged}\ 674 674 ${optionalString (cfg.apiserver.tlsCertFile != null) 675 675 "--tls-cert-file=${cfg.apiserver.tlsCertFile}"} \ 676 676 ${optionalString (cfg.apiserver.tlsKeyFile != null) 677 677 "--tls-private-key-file=${cfg.apiserver.tlsKeyFile}"} \ 678 678 ${optionalString (cfg.apiserver.tokenAuth != null) 679 679 "--token-auth-file=${cfg.apiserver.tokenAuth}"} \ 680 - --kubelet-https=${if cfg.apiserver.kubeletHttps then "true" else "false"} \ 680 + --kubelet-https=${boolToString cfg.apiserver.kubeletHttps} \ 681 681 ${optionalString (cfg.apiserver.kubeletClientCaFile != null) 682 682 "--kubelet-certificate-authority=${cfg.apiserver.kubeletClientCaFile}"} \ 683 683 ${optionalString (cfg.apiserver.kubeletClientCertFile != null) ··· 719 719 ExecStart = ''${cfg.package}/bin/kube-scheduler \ 720 720 --address=${cfg.scheduler.address} \ 721 721 --port=${toString cfg.scheduler.port} \ 722 - --leader-elect=${if cfg.scheduler.leaderElect then "true" else "false"} \ 722 + --leader-elect=${boolToString cfg.scheduler.leaderElect} \ 723 723 --kubeconfig=${kubeconfig} \ 724 724 ${optionalString cfg.verbose "--v=6"} \ 725 725 ${optionalString cfg.verbose "--log-flush-frequency=1s"} \ ··· 744 744 --address=${cfg.controllerManager.address} \ 745 745 --port=${toString cfg.controllerManager.port} \ 746 746 --kubeconfig=${kubeconfig} \ 747 - --leader-elect=${if cfg.controllerManager.leaderElect then "true" else "false"} \ 747 + --leader-elect=${boolToString cfg.controllerManager.leaderElect} \ 748 748 ${if (cfg.controllerManager.serviceAccountKeyFile!=null) 749 749 then "--service-account-private-key-file=${cfg.controllerManager.serviceAccountKeyFile}" 750 750 else "--service-account-private-key-file=/var/run/kubernetes/apiserver.key"} \
+1 -1
nixos/modules/services/continuous-integration/hydra/default.nix
··· 328 328 IN_SYSTEMD = "1"; # to get log severity levels 329 329 }; 330 330 serviceConfig = 331 - { ExecStart = "@${cfg.package}/bin/hydra-queue-runner hydra-queue-runner -v --option build-use-substitutes ${if cfg.useSubstitutes then "true" else "false"}"; 331 + { ExecStart = "@${cfg.package}/bin/hydra-queue-runner hydra-queue-runner -v --option build-use-substitutes ${boolToString cfg.useSubstitutes}"; 332 332 ExecStopPost = "${cfg.package}/bin/hydra-queue-runner --unlock"; 333 333 User = "hydra-queue-runner"; 334 334 Restart = "always";
+4 -4
nixos/modules/services/databases/cassandra.nix
··· 21 21 cassandraConf = '' 22 22 cluster_name: ${cfg.clusterName} 23 23 num_tokens: 256 24 - auto_bootstrap: ${if cfg.autoBootstrap then "true" else "false"} 25 - hinted_handoff_enabled: ${if cfg.hintedHandOff then "true" else "false"} 24 + auto_bootstrap: ${boolToString cfg.autoBootstrap} 25 + hinted_handoff_enabled: ${boolToString cfg.hintedHandOff} 26 26 hinted_handoff_throttle_in_kb: ${builtins.toString cfg.hintedHandOffThrottle} 27 27 max_hints_delivery_threads: 2 28 28 max_hint_window_in_ms: 10800000 # 3 hours ··· 62 62 rpc_keepalive: true 63 63 rpc_server_type: sync 64 64 thrift_framed_transport_size_in_mb: 15 65 - incremental_backups: ${if cfg.incrementalBackups then "true" else "false"} 65 + incremental_backups: ${boolToString cfg.incrementalBackups} 66 66 snapshot_before_compaction: false 67 67 auto_snapshot: true 68 68 column_index_size_in_kb: 64 ··· 89 89 truststore: ${cfg.trustStorePath} 90 90 truststore_password: ${cfg.trustStorePassword} 91 91 client_encryption_options: 92 - enabled: ${if cfg.clientEncryption then "true" else "false"} 92 + enabled: ${boolToString cfg.clientEncryption} 93 93 keystore: ${cfg.keyStorePath} 94 94 keystore_password: ${cfg.keyStorePassword} 95 95 internode_compression: all
-2
nixos/modules/services/databases/mongodb.nix
··· 4 4 5 5 let 6 6 7 - b2s = x: if x then "true" else "false"; 8 - 9 7 cfg = config.services.mongodb; 10 8 11 9 mongodb = cfg.package;
+2 -3
nixos/modules/services/logging/graylog.nix
··· 4 4 5 5 let 6 6 cfg = config.services.graylog; 7 - configBool = b: if b then "true" else "false"; 8 7 9 8 confFile = pkgs.writeText "graylog.conf" '' 10 - is_master = ${configBool cfg.isMaster} 9 + is_master = ${boolToString cfg.isMaster} 11 10 node_id_file = ${cfg.nodeIdFile} 12 11 password_secret = ${cfg.passwordSecret} 13 12 root_username = ${cfg.rootUsername} 14 13 root_password_sha2 = ${cfg.rootPasswordSha2} 15 14 elasticsearch_cluster_name = ${cfg.elasticsearchClusterName} 16 - elasticsearch_discovery_zen_ping_multicast_enabled = ${configBool cfg.elasticsearchDiscoveryZenPingMulticastEnabled} 15 + elasticsearch_discovery_zen_ping_multicast_enabled = ${boolToString cfg.elasticsearchDiscoveryZenPingMulticastEnabled} 17 16 elasticsearch_discovery_zen_ping_unicast_hosts = ${cfg.elasticsearchDiscoveryZenPingUnicastHosts} 18 17 message_journal_dir = ${cfg.messageJournalDir} 19 18 mongodb_uri = ${cfg.mongodbUri}
+1 -1
nixos/modules/services/misc/cgminer.nix
··· 6 6 cfg = config.services.cgminer; 7 7 8 8 convType = with builtins; 9 - v: if isBool v then (if v then "true" else "false") else toString v; 9 + v: if isBool v then boolToString v else toString v; 10 10 mergedHwConfig = 11 11 mapAttrsToList (n: v: ''"${n}": "${(concatStringsSep "," (map convType v))}"'') 12 12 (foldAttrs (n: a: [n] ++ a) [] cfg.hardware);
+1 -1
nixos/modules/services/misc/confd.nix
··· 12 12 nodes = [ ${concatMapStringsSep "," (s: ''"${s}"'') cfg.nodes}, ] 13 13 prefix = "${cfg.prefix}" 14 14 log-level = "${cfg.logLevel}" 15 - watch = ${if cfg.watch then "true" else "false"} 15 + watch = ${boolToString cfg.watch} 16 16 ''; 17 17 18 18 in {
+12 -13
nixos/modules/services/misc/matrix-synapse.nix
··· 5 5 let 6 6 cfg = config.services.matrix-synapse; 7 7 logConfigFile = pkgs.writeText "log_config.yaml" cfg.logConfig; 8 - mkResource = r: ''{names: ${builtins.toJSON r.names}, compress: ${fromBool r.compress}}''; 9 - mkListener = l: ''{port: ${toString l.port}, bind_address: "${l.bind_address}", type: ${l.type}, tls: ${fromBool l.tls}, x_forwarded: ${fromBool l.x_forwarded}, resources: [${concatStringsSep "," (map mkResource l.resources)}]}''; 10 - fromBool = x: if x then "true" else "false"; 8 + mkResource = r: ''{names: ${builtins.toJSON r.names}, compress: ${boolToString r.compress}}''; 9 + mkListener = l: ''{port: ${toString l.port}, bind_address: "${l.bind_address}", type: ${l.type}, tls: ${boolToString l.tls}, x_forwarded: ${boolToString l.x_forwarded}, resources: [${concatStringsSep "," (map mkResource l.resources)}]}''; 11 10 configFile = pkgs.writeText "homeserver.yaml" '' 12 11 ${optionalString (cfg.tls_certificate_path != null) '' 13 12 tls_certificate_path: "${cfg.tls_certificate_path}" ··· 18 17 ${optionalString (cfg.tls_dh_params_path != null) '' 19 18 tls_dh_params_path: "${cfg.tls_dh_params_path}" 20 19 ''} 21 - no_tls: ${fromBool cfg.no_tls} 20 + no_tls: ${boolToString cfg.no_tls} 22 21 ${optionalString (cfg.bind_port != null) '' 23 22 bind_port: ${toString cfg.bind_port} 24 23 ''} ··· 30 29 ''} 31 30 server_name: "${cfg.server_name}" 32 31 pid_file: "/var/run/matrix-synapse.pid" 33 - web_client: ${fromBool cfg.web_client} 32 + web_client: ${boolToString cfg.web_client} 34 33 ${optionalString (cfg.public_baseurl != null) '' 35 34 public_baseurl: "${cfg.public_baseurl}" 36 35 ''} ··· 58 57 uploads_path: "/var/lib/matrix-synapse/uploads" 59 58 max_upload_size: "${cfg.max_upload_size}" 60 59 max_image_pixels: "${cfg.max_image_pixels}" 61 - dynamic_thumbnails: ${fromBool cfg.dynamic_thumbnails} 62 - url_preview_enabled: ${fromBool cfg.url_preview_enabled} 60 + dynamic_thumbnails: ${boolToString cfg.dynamic_thumbnails} 61 + url_preview_enabled: ${boolToString cfg.url_preview_enabled} 63 62 ${optionalString (cfg.url_preview_enabled == true) '' 64 63 url_preview_ip_range_blacklist: ${builtins.toJSON cfg.url_preview_ip_range_blacklist} 65 64 url_preview_ip_range_whitelist: ${builtins.toJSON cfg.url_preview_ip_range_whitelist} ··· 67 66 ''} 68 67 recaptcha_private_key: "${cfg.recaptcha_private_key}" 69 68 recaptcha_public_key: "${cfg.recaptcha_public_key}" 70 - enable_registration_captcha: ${fromBool cfg.enable_registration_captcha} 69 + enable_registration_captcha: ${boolToString cfg.enable_registration_captcha} 71 70 turn_uris: ${builtins.toJSON cfg.turn_uris} 72 71 turn_shared_secret: "${cfg.turn_shared_secret}" 73 - enable_registration: ${fromBool cfg.enable_registration} 72 + enable_registration: ${boolToString cfg.enable_registration} 74 73 ${optionalString (cfg.registration_shared_secret != null) '' 75 74 registration_shared_secret: "${cfg.registration_shared_secret}" 76 75 ''} ··· 78 77 turn_user_lifetime: "${cfg.turn_user_lifetime}" 79 78 user_creation_max_duration: ${cfg.user_creation_max_duration} 80 79 bcrypt_rounds: ${cfg.bcrypt_rounds} 81 - allow_guest_access: ${fromBool cfg.allow_guest_access} 80 + allow_guest_access: ${boolToString cfg.allow_guest_access} 82 81 trusted_third_party_id_servers: ${builtins.toJSON cfg.trusted_third_party_id_servers} 83 82 room_invite_state_types: ${builtins.toJSON cfg.room_invite_state_types} 84 83 ${optionalString (cfg.macaroon_secret_key != null) '' 85 84 macaroon_secret_key: "${cfg.macaroon_secret_key}" 86 85 ''} 87 - expire_access_token: ${fromBool cfg.expire_access_token} 88 - enable_metrics: ${fromBool cfg.enable_metrics} 89 - report_stats: ${fromBool cfg.report_stats} 86 + expire_access_token: ${boolToString cfg.expire_access_token} 87 + enable_metrics: ${boolToString cfg.enable_metrics} 88 + report_stats: ${boolToString cfg.report_stats} 90 89 signing_key_path: "/var/lib/matrix-synapse/homeserver.signing.key" 91 90 key_refresh_interval: "${cfg.key_refresh_interval}" 92 91 perspectives:
+2 -2
nixos/modules/services/misc/nix-daemon.nix
··· 41 41 build-users-group = nixbld 42 42 build-max-jobs = ${toString (cfg.maxJobs)} 43 43 build-cores = ${toString (cfg.buildCores)} 44 - build-use-sandbox = ${if (builtins.isBool cfg.useSandbox) then (if cfg.useSandbox then "true" else "false") else cfg.useSandbox} 44 + build-use-sandbox = ${if (builtins.isBool cfg.useSandbox) then boolToString cfg.useSandbox else cfg.useSandbox} 45 45 build-sandbox-paths = ${toString cfg.sandboxPaths} /bin/sh=${sh} $(echo $extraPaths) 46 46 binary-caches = ${toString cfg.binaryCaches} 47 47 trusted-binary-caches = ${toString cfg.trustedBinaryCaches} 48 48 binary-cache-public-keys = ${toString cfg.binaryCachePublicKeys} 49 - auto-optimise-store = ${if cfg.autoOptimiseStore then "true" else "false"} 49 + auto-optimise-store = ${boolToString cfg.autoOptimiseStore} 50 50 ${optionalString cfg.requireSignedBinaryCaches '' 51 51 signed-binary-caches = * 52 52 ''}
+1 -1
nixos/modules/services/misc/taskserver/default.nix
··· 128 128 certBits = cfg.pki.auto.bits; 129 129 clientExpiration = cfg.pki.auto.expiration.client; 130 130 crlExpiration = cfg.pki.auto.expiration.crl; 131 - isAutoConfig = if needToCreateCA then "True" else "False"; 131 + isAutoConfig = boolToString needToCreateCA; 132 132 }}" > "$out/main.py" 133 133 cat > "$out/setup.py" <<EOF 134 134 from setuptools import setup
+1 -1
nixos/modules/services/monitoring/collectd.nix
··· 8 8 conf = pkgs.writeText "collectd.conf" '' 9 9 BaseDir "${cfg.dataDir}" 10 10 PIDFile "${cfg.pidFile}" 11 - AutoLoadPlugin ${if cfg.autoLoadPlugin then "true" else "false"} 11 + AutoLoadPlugin ${boolToString cfg.autoLoadPlugin} 12 12 Hostname "${config.networking.hostName}" 13 13 14 14 LoadPlugin syslog
+5 -7
nixos/modules/services/monitoring/grafana.nix
··· 5 5 let 6 6 cfg = config.services.grafana; 7 7 8 - b2s = val: if val then "true" else "false"; 9 - 10 8 envOptions = { 11 9 PATHS_DATA = cfg.dataDir; 12 10 PATHS_PLUGINS = "${cfg.dataDir}/plugins"; ··· 32 30 SECURITY_ADMIN_PASSWORD = cfg.security.adminPassword; 33 31 SECURITY_SECRET_KEY = cfg.security.secretKey; 34 32 35 - USERS_ALLOW_SIGN_UP = b2s cfg.users.allowSignUp; 36 - USERS_ALLOW_ORG_CREATE = b2s cfg.users.allowOrgCreate; 37 - USERS_AUTO_ASSIGN_ORG = b2s cfg.users.autoAssignOrg; 33 + USERS_ALLOW_SIGN_UP = boolToString cfg.users.allowSignUp; 34 + USERS_ALLOW_ORG_CREATE = boolToString cfg.users.allowOrgCreate; 35 + USERS_AUTO_ASSIGN_ORG = boolToString cfg.users.autoAssignOrg; 38 36 USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole; 39 37 40 - AUTH_ANONYMOUS_ENABLED = b2s cfg.auth.anonymous.enable; 38 + AUTH_ANONYMOUS_ENABLED = boolToString cfg.auth.anonymous.enable; 41 39 AUTH_ANONYMOUS_ORG_NAME = cfg.auth.anonymous.org_name; 42 40 AUTH_ANONYMOUS_ORG_ROLE = cfg.auth.anonymous.org_role; 43 41 44 - ANALYTICS_REPORTING_ENABLED = b2s cfg.analytics.reporting.enable; 42 + ANALYTICS_REPORTING_ENABLED = boolToString cfg.analytics.reporting.enable; 45 43 } // cfg.extraOptions; 46 44 47 45 in {
+1 -1
nixos/modules/services/network-filesystems/netatalk.nix
··· 9 9 extmapFile = pkgs.writeText "extmap.conf" cfg.extmap; 10 10 11 11 afpToString = x: if builtins.typeOf x == "bool" 12 - then (if x then "true" else "false") 12 + then boolToString x 13 13 else toString x; 14 14 15 15 volumeConfig = name:
+1 -1
nixos/modules/services/network-filesystems/samba.nix
··· 5 5 let 6 6 7 7 smbToString = x: if builtins.typeOf x == "bool" 8 - then (if x then "true" else "false") 8 + then boolToString x 9 9 else toString x; 10 10 11 11 cfg = config.services.samba;
+3 -3
nixos/modules/services/network-filesystems/tahoe.nix
··· 290 290 shares.total = ${toString settings.client.shares.total} 291 291 292 292 [storage] 293 - enabled = ${if settings.storage.enable then "true" else "false"} 293 + enabled = ${boolToString settings.storage.enable} 294 294 reserved_space = ${settings.storage.reservedSpace} 295 295 296 296 [helper] 297 - enabled = ${if settings.helper.enable then "true" else "false"} 297 + enabled = ${boolToString settings.helper.enable} 298 298 299 299 [sftpd] 300 - enabled = ${if settings.sftpd.enable then "true" else "false"} 300 + enabled = ${boolToString settings.sftpd.enable} 301 301 ${optionalString (settings.sftpd.port != null) 302 302 "port = ${toString settings.sftpd.port}"} 303 303 ${optionalString (settings.sftpd.hostPublicKeyFile != null)
+7 -8
nixos/modules/services/networking/aiccu.nix
··· 5 5 let 6 6 7 7 cfg = config.services.aiccu; 8 - showBool = b: if b then "true" else "false"; 9 8 notNull = a: ! isNull a; 10 9 configFile = pkgs.writeText "aiccu.conf" '' 11 10 ${if notNull cfg.username then "username " + cfg.username else ""} ··· 13 12 protocol ${cfg.protocol} 14 13 server ${cfg.server} 15 14 ipv6_interface ${cfg.interfaceName} 16 - verbose ${showBool cfg.verbose} 15 + verbose ${boolToString cfg.verbose} 17 16 daemonize true 18 - automatic ${showBool cfg.automatic} 19 - requiretls ${showBool cfg.requireTLS} 17 + automatic ${boolToString cfg.automatic} 18 + requiretls ${boolToString cfg.requireTLS} 20 19 pidfile ${cfg.pidFile} 21 - defaultroute ${showBool cfg.defaultRoute} 20 + defaultroute ${boolToString cfg.defaultRoute} 22 21 ${if notNull cfg.setupScript then cfg.setupScript else ""} 23 - makebeats ${showBool cfg.makeHeartBeats} 24 - noconfigure ${showBool cfg.noConfigure} 25 - behindnat ${showBool cfg.behindNAT} 22 + makebeats ${boolToString cfg.makeHeartBeats} 23 + noconfigure ${boolToString cfg.noConfigure} 24 + behindnat ${boolToString cfg.behindNAT} 26 25 ${if cfg.localIPv4Override then "local_ipv4_override" else ""} 27 26 ''; 28 27
+4 -5
nixos/modules/services/networking/btsync.nix
··· 9 9 10 10 listenAddr = cfg.httpListenAddr + ":" + (toString cfg.httpListenPort); 11 11 12 - boolStr = x: if x then "true" else "false"; 13 12 optionalEmptyStr = b: v: optionalString (b != "") v; 14 13 15 14 webUIConfig = optionalString cfg.enableWebUI ··· 31 30 sharedFoldersRecord = 32 31 concatStringsSep "," (map (entry: 33 32 let helper = attr: v: 34 - if (entry ? attr) then boolStr entry.attr else boolStr v; 33 + if (entry ? attr) then boolToString entry.attr else boolToString v; 35 34 in 36 35 '' 37 36 { ··· 65 64 "listening_port": ${toString cfg.listeningPort}, 66 65 "use_gui": false, 67 66 68 - "check_for_updates": ${boolStr cfg.checkForUpdates}, 69 - "use_upnp": ${boolStr cfg.useUpnp}, 67 + "check_for_updates": ${boolToString cfg.checkForUpdates}, 68 + "use_upnp": ${boolToString cfg.useUpnp}, 70 69 "download_limit": ${toString cfg.downloadLimit}, 71 70 "upload_limit": ${toString cfg.uploadLimit}, 72 - "lan_encrypt_data": ${boolStr cfg.encryptLAN}, 71 + "lan_encrypt_data": ${boolToString cfg.encryptLAN}, 73 72 74 73 ${webUIConfig} 75 74 ${sharedFoldersConfig}
+1 -1
nixos/modules/services/networking/firefox/sync-server.nix
··· 19 19 [syncserver] 20 20 public_url = ${cfg.publicUrl} 21 21 ${optionalString (cfg.sqlUri != "") "sqluri = ${cfg.sqlUri}"} 22 - allow_new_users = ${if cfg.allowNewUsers then "true" else "false"} 22 + allow_new_users = ${boolToString cfg.allowNewUsers} 23 23 24 24 [browserid] 25 25 backend = tokenserver.verifiers.LocalVerifier
+9 -11
nixos/modules/services/networking/i2pd.nix
··· 10 10 11 11 extip = "EXTIP=\$(${pkgs.curl.bin}/bin/curl -sLf \"http://jsonip.com\" | ${pkgs.gawk}/bin/awk -F'\"' '{print $4}')"; 12 12 13 - toYesNo = b: if b then "true" else "false"; 14 - 15 13 mkEndpointOpt = name: addr: port: { 16 14 enable = mkEnableOption name; 17 15 name = mkOption { ··· 76 74 77 75 i2pdConf = pkgs.writeText "i2pd.conf" 78 76 '' 79 - ipv4 = ${toYesNo cfg.enableIPv4} 80 - ipv6 = ${toYesNo cfg.enableIPv6} 81 - notransit = ${toYesNo cfg.notransit} 82 - floodfill = ${toYesNo cfg.floodfill} 77 + ipv4 = ${boolToString cfg.enableIPv4} 78 + ipv6 = ${boolToString cfg.enableIPv6} 79 + notransit = ${boolToString cfg.notransit} 80 + floodfill = ${boolToString cfg.floodfill} 83 81 netid = ${toString cfg.netid} 84 82 ${if isNull cfg.bandwidth then "" else "bandwidth = ${toString cfg.bandwidth}" } 85 83 ${if isNull cfg.port then "" else "port = ${toString cfg.port}"} ··· 88 86 transittunnels = ${toString cfg.limits.transittunnels} 89 87 90 88 [upnp] 91 - enabled = ${toYesNo cfg.upnp.enable} 89 + enabled = ${boolToString cfg.upnp.enable} 92 90 name = ${cfg.upnp.name} 93 91 94 92 [precomputation] 95 - elgamal = ${toYesNo cfg.precomputation.elgamal} 93 + elgamal = ${boolToString cfg.precomputation.elgamal} 96 94 97 95 [reseed] 98 - verify = ${toYesNo cfg.reseed.verify} 96 + verify = ${boolToString cfg.reseed.verify} 99 97 file = ${cfg.reseed.file} 100 98 urls = ${builtins.concatStringsSep "," cfg.reseed.urls} 101 99 ··· 107 105 (proto: let portStr = toString proto.port; in 108 106 '' 109 107 [${proto.name}] 110 - enabled = ${toYesNo proto.enable} 108 + enabled = ${boolToString proto.enable} 111 109 address = ${proto.address} 112 110 port = ${toString proto.port} 113 111 ${if proto ? keys then "keys = ${proto.keys}" else ""} 114 - ${if proto ? auth then "auth = ${toYesNo proto.auth}" else ""} 112 + ${if proto ? auth then "auth = ${boolToString proto.auth}" else ""} 115 113 ${if proto ? user then "user = ${proto.user}" else ""} 116 114 ${if proto ? pass then "pass = ${proto.pass}" else ""} 117 115 ${if proto ? outproxy then "outproxy = ${proto.outproxy}" else ""}
+1 -1
nixos/modules/services/networking/ircd-hybrid/default.nix
··· 12 12 substFiles = [ "=>/conf" ./ircd.conf ]; 13 13 inherit (pkgs) ircdHybrid coreutils su iproute gnugrep procps; 14 14 15 - ipv6Enabled = if config.networking.enableIPv6 then "true" else "false"; 15 + ipv6Enabled = boolToString config.networking.enableIPv6; 16 16 17 17 inherit (cfg) serverName sid description adminEmail 18 18 extraPort;
+1 -1
nixos/modules/services/networking/mosquitto.nix
··· 16 16 pid_file /run/mosquitto/pid 17 17 acl_file ${aclFile} 18 18 persistence true 19 - allow_anonymous ${if cfg.allowAnonymous then "true" else "false"} 19 + allow_anonymous ${boolToString cfg.allowAnonymous} 20 20 bind_address ${cfg.host} 21 21 port ${toString cfg.port} 22 22 ${listenerConf}
+5 -5
nixos/modules/services/networking/murmur.nix
··· 26 26 27 27 textmessagelength=${toString cfg.textMsgLength} 28 28 imagemessagelength=${toString cfg.imgMsgLength} 29 - allowhtml=${if cfg.allowHtml then "true" else "false"} 29 + allowhtml=${boolToString cfg.allowHtml} 30 30 logdays=${toString cfg.logDays} 31 - bonjour=${if cfg.bonjour then "true" else "false"} 32 - sendversion=${if cfg.sendVersion then "true" else "false"} 31 + bonjour=${babelToString cfg.bonjour} 32 + sendversion=${babelToString cfg.sendVersion} 33 33 34 34 ${if cfg.registerName == "" then "" else "registerName="+cfg.registerName} 35 35 ${if cfg.registerPassword == "" then "" else "registerPassword="+cfg.registerPassword} 36 36 ${if cfg.registerUrl == "" then "" else "registerUrl="+cfg.registerUrl} 37 37 ${if cfg.registerHostname == "" then "" else "registerHostname="+cfg.registerHostname} 38 38 39 - certrequired=${if cfg.clientCertRequired then "true" else "false"} 39 + certrequired=${babelToString cfg.clientCertRequired} 40 40 ${if cfg.sslCert == "" then "" else "sslCert="+cfg.sslCert} 41 41 ${if cfg.sslKey == "" then "" else "sslKey="+cfg.sslKey} 42 42 ${if cfg.sslCa == "" then "" else "sslCA="+cfg.sslCa} 43 - 43 + 44 44 ${cfg.extraConfig} 45 45 ''; 46 46 in
+2 -2
nixos/modules/services/networking/prosody.nix
··· 219 219 220 220 data_path = "/var/lib/prosody" 221 221 222 - allow_registration = ${ if cfg.allowRegistration then "true" else "false" }; 222 + allow_registration = ${boolToString cfg.allowRegistration}; 223 223 224 224 ${ optionalString cfg.modules.console "console_enabled = true;" } 225 225 ··· 244 244 245 245 ${ lib.concatStringsSep "\n" (lib.mapAttrsToList (n: v: '' 246 246 VirtualHost "${v.domain}" 247 - enabled = ${if v.enabled then "true" else "false"}; 247 + enabled = ${boolToString v.enabled}; 248 248 ${ optionalString (v.ssl != null) (createSSLOptsStr v.ssl) } 249 249 ${ v.extraConfig } 250 250 '') cfg.virtualHosts) }
+1 -1
nixos/modules/services/networking/sslh.nix
··· 5 5 let 6 6 cfg = config.services.sslh; 7 7 configFile = pkgs.writeText "sslh.conf" '' 8 - verbose: ${if cfg.verbose then "true" else "false"}; 8 + verbose: ${boolToString cfg.verbose}; 9 9 foreground: true; 10 10 inetd: false; 11 11 numeric: false;
+1 -1
nixos/modules/services/networking/znc.nix
··· 35 35 Port = ${toString confOpts.port} 36 36 IPv4 = true 37 37 IPv6 = true 38 - SSL = ${if confOpts.useSSL then "true" else "false"} 38 + SSL = ${boolToString confOpts.useSSL} 39 39 </Listener> 40 40 41 41 <User ${confOpts.userName}>
+7 -10
nixos/modules/services/security/oauth2_proxy.nix
··· 10 10 # repeatedArgs (arg: "--arg=${arg}") args 11 11 repeatedArgs = concatMapStringsSep " "; 12 12 13 - # 'toString' doesn't quite do what we want for bools. 14 - fromBool = x: if x then "true" else "false"; 15 - 16 13 # oauth2_proxy provides many options that are only relevant if you are using 17 14 # a certain provider. This set maps from provider name to a function that 18 15 # takes the configuration and returns a string that can be inserted into the ··· 49 46 --client-secret='${cfg.clientSecret}' \ 50 47 ${optionalString (!isNull cfg.cookie.domain) "--cookie-domain='${cfg.cookie.domain}'"} \ 51 48 --cookie-expire='${cfg.cookie.expire}' \ 52 - --cookie-httponly=${fromBool cfg.cookie.httpOnly} \ 49 + --cookie-httponly=${boolToString cfg.cookie.httpOnly} \ 53 50 --cookie-name='${cfg.cookie.name}' \ 54 51 --cookie-secret='${cfg.cookie.secret}' \ 55 - --cookie-secure=${fromBool cfg.cookie.secure} \ 52 + --cookie-secure=${boolToString cfg.cookie.secure} \ 56 53 ${optionalString (!isNull cfg.cookie.refresh) "--cookie-refresh='${cfg.cookie.refresh}'"} \ 57 54 ${optionalString (!isNull cfg.customTemplatesDir) "--custom-templates-dir='${cfg.customTemplatesDir}'"} \ 58 55 ${repeatedArgs (x: "--email-domain='${x}'") cfg.email.domains} \ 59 56 --http-address='${cfg.httpAddress}' \ 60 - ${optionalString (!isNull cfg.htpasswd.file) "--htpasswd-file='${cfg.htpasswd.file}' --display-htpasswd-form=${fromBool cfg.htpasswd.displayForm}"} \ 57 + ${optionalString (!isNull cfg.htpasswd.file) "--htpasswd-file='${cfg.htpasswd.file}' --display-htpasswd-form=${boolToString cfg.htpasswd.displayForm}"} \ 61 58 ${optionalString (!isNull cfg.loginURL) "--login-url='${cfg.loginURL}'"} \ 62 - --pass-access-token=${fromBool cfg.passAccessToken} \ 63 - --pass-basic-auth=${fromBool cfg.passBasicAuth} \ 64 - --pass-host-header=${fromBool cfg.passHostHeader} \ 59 + --pass-access-token=${boolToString cfg.passAccessToken} \ 60 + --pass-basic-auth=${boolToString cfg.passBasicAuth} \ 61 + --pass-host-header=${boolToString cfg.passHostHeader} \ 65 62 --proxy-prefix='${cfg.proxyPrefix}' \ 66 63 ${optionalString (!isNull cfg.profileURL) "--profile-url='${cfg.profileURL}'"} \ 67 64 ${optionalString (!isNull cfg.redeemURL) "--redeem-url='${cfg.redeemURL}'"} \ 68 65 ${optionalString (!isNull cfg.redirectURL) "--redirect-url='${cfg.redirectURL}'"} \ 69 - --request-logging=${fromBool cfg.requestLogging} \ 66 + --request-logging=${boolToString cfg.requestLogging} \ 70 67 ${optionalString (!isNull cfg.scope) "--scope='${cfg.scope}'"} \ 71 68 ${repeatedArgs (x: "--skip-auth-regex='${x}'") cfg.skipAuthRegexes} \ 72 69 ${optionalString (!isNull cfg.signatureKey) "--signature-key='${cfg.signatureKey}'"} \
+1 -2
nixos/modules/services/torrent/transmission.nix
··· 15 15 16 16 # Strings must be quoted, ints and bools must not (for settings.json). 17 17 toOption = x: 18 - if x == true then "true" 19 - else if x == false then "false" 18 + if isBool x then boolToString x 20 19 else if isInt x then toString x 21 20 else toString ''"${x}"''; 22 21
+1 -1
nixos/modules/services/web-apps/atlassian/crowd.nix
··· 137 137 138 138 sed -e 's,port="8095",port="${toString cfg.listenPort}" address="${cfg.listenAddress}",' \ 139 139 '' + (lib.optionalString cfg.proxy.enable '' 140 - -e 's,compression="on",compression="off" protocol="HTTP/1.1" proxyName="${cfg.proxy.name}" proxyPort="${toString cfg.proxy.port}" scheme="${cfg.proxy.scheme}" secure="${if cfg.proxy.secure then "true" else "false"}",' \ 140 + -e 's,compression="on",compression="off" protocol="HTTP/1.1" proxyName="${cfg.proxy.name}" proxyPort="${toString cfg.proxy.port}" scheme="${cfg.proxy.scheme}" secure="${boolToString cfg.proxy.secure}",' \ 141 141 '') + '' 142 142 ${pkg}/apache-tomcat/conf/server.xml.dist > ${cfg.home}/server.xml 143 143 '';
+2 -2
nixos/modules/services/web-apps/quassel-webserver.nix
··· 12 12 port: ${toString cfg.quasselCorePort}, // quasselcore port 13 13 initialBacklogLimit: ${toString cfg.initialBacklogLimit}, // Amount of backlogs to fetch per buffer on connection 14 14 backlogLimit: ${toString cfg.backlogLimit}, // Amount of backlogs to fetch per buffer after first retrieval 15 - securecore: ${if cfg.secureCore then "true" else "false"}, // Connect to the core using SSL 15 + securecore: ${boolToString cfg.secureCore}, // Connect to the core using SSL 16 16 theme: '${cfg.theme}' // Default UI theme 17 17 }, 18 18 themes: ['default', 'darksolarized'], // Available themes 19 - forcedefault: ${if cfg.forceHostAndPort then "true" else "false"}, // Will force default host and port to be used, and will hide the corresponding fields in the UI 19 + forcedefault: ${boolToString cfg.forceHostAndPort}, // Will force default host and port to be used, and will hide the corresponding fields in the UI 20 20 prefixpath: '${cfg.prefixPath}' // Configure this if you use a reverse proxy 21 21 }; 22 22 '';
-2
nixos/modules/services/web-apps/tt-rss.nix
··· 6 6 7 7 configVersion = 26; 8 8 9 - boolToString = b: if b then "true" else "false"; 10 - 11 9 cacheDir = "cache"; 12 10 lockDir = "lock"; 13 11 feedIconsDir = "feed-icons";
+1 -1
nixos/modules/services/x11/display-managers/sddm.nix
··· 59 59 [Autologin] 60 60 User=${cfg.autoLogin.user} 61 61 Session=${defaultSessionName}.desktop 62 - Relogin=${if cfg.autoLogin.relogin then "true" else "false"} 62 + Relogin=${boolToString cfg.autoLogin.relogin} 63 63 ''} 64 64 65 65 ${cfg.extraConfig}
+1 -1
nixos/modules/services/x11/hardware/multitouch.nix
··· 74 74 MatchIsTouchpad "on" 75 75 Identifier "Touchpads" 76 76 Driver "mtrack" 77 - Option "IgnorePalm" "${if cfg.ignorePalm then "true" else "false"}" 77 + Option "IgnorePalm" "${boolToString cfg.ignorePalm}" 78 78 Option "ClickFinger1" "${builtins.elemAt cfg.buttonsMap 0}" 79 79 Option "ClickFinger2" "${builtins.elemAt cfg.buttonsMap 1}" 80 80 Option "ClickFinger3" "${builtins.elemAt cfg.buttonsMap 2}"
+1 -1
pkgs/development/java-modules/build-maven-package.nix
··· 27 27 echo "<settings><mirrors>\ 28 28 <mirror><id>tmpm2</id><url>file://$out/m2</url><mirrorOf>*</mirrorOf></mirror></mirrors>\ 29 29 <localRepository>$out/m2/</localRepository></settings>" >> $out/m2/settings.xml 30 - ${maven}/bin/mvn ${optionalString (quiet) "-q"} clean package -Dmaven.test.skip=${if skipTests then "true" else "false"} -Danimal.sniffer.skip=true -gs $out/m2/settings.xml 30 + ${maven}/bin/mvn ${optionalString (quiet) "-q"} clean package -Dmaven.test.skip=${boolToString skipTests} -Danimal.sniffer.skip=true -gs $out/m2/settings.xml 31 31 cp ./target/*.jar $out/m2/${m2Path} 32 32 cp -v ./target/*.jar $out/target/ 33 33 '';
+6 -4
pkgs/development/ocaml-modules/mtime/default.nix
··· 1 - { stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, js_of_ocaml 1 + { stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, opam, js_of_ocaml 2 2 , jsooSupport ? !(stdenv.lib.versionAtLeast ocaml.version "4.04") 3 3 }: 4 + 5 + with lib; 4 6 5 7 stdenv.mkDerivation { 6 8 name = "ocaml${ocaml.version}-mtime-0.8.3"; ··· 15 17 buildInputs = [ ocaml findlib ocamlbuild opam ] 16 18 ++ stdenv.lib.optional jsooSupport js_of_ocaml; 17 19 18 - buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true jsoo=${if jsooSupport then "true" else "false"}"; 20 + buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true jsoo=${boolToString jsooSupport}"; 19 21 20 22 installPhase = "opam-installer -i --prefix=$out --libdir=$OCAMLFIND_DESTDIR"; 21 23 ··· 23 25 description = "Monotonic wall-clock time for OCaml"; 24 26 homepage = http://erratique.ch/software/mtime; 25 27 inherit (ocaml.meta) platforms; 26 - maintainers = [ stdenv.lib.maintainers.vbgl ]; 27 - license = stdenv.lib.licenses.bsd3; 28 + maintainers = [ maintainers.vbgl ]; 29 + license = licenses.bsd3; 28 30 }; 29 31 }
+1 -1
pkgs/development/ocaml-modules/nocrypto/default.nix
··· 24 24 25 25 buildPhase = '' 26 26 LD_LIBRARY_PATH=${cpuid}/lib/ocaml/${ocaml.version}/site-lib/stubslibs/ \ 27 - ${topkg.buildPhase} --with-lwt ${if withLwt then "true" else "false"} 27 + ${topkg.buildPhase} --with-lwt ${boolToString withLwt} 28 28 ''; 29 29 inherit (topkg) installPhase; 30 30
+1 -1
pkgs/development/ocaml-modules/notty/default.nix
··· 29 29 optional withLwt lwt; 30 30 31 31 buildPhase = topkg.buildPhase 32 - + " --with-lwt ${if withLwt then "true" else "false"}"; 32 + + " --with-lwt ${boolToString withLwt}"; 33 33 34 34 inherit (topkg) installPhase; 35 35
+8 -6
pkgs/development/ocaml-modules/vg/default.nix
··· 1 - { stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg 1 + { stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg 2 2 , uchar, result, gg, uutf, otfm, js_of_ocaml, 3 3 pdfBackend ? true, # depends on uutf and otfm 4 4 htmlcBackend ? true # depends on js_of_ocaml 5 5 }: 6 + 7 + with lib; 6 8 7 9 let 8 10 inherit (stdenv.lib) optionals versionAtLeast; ··· 10 12 pname = "vg"; 11 13 version = "0.9.0"; 12 14 webpage = "http://erratique.ch/software/${pname}"; 13 - sob = b: if b then "true" else "false"; 14 15 in 15 16 16 17 assert versionAtLeast ocaml.version "4.02.0"; ··· 35 36 unpackCmd = "tar xjf $src"; 36 37 37 38 buildPhase = topkg.buildPhase 38 - + " --with-uutf ${sob pdfBackend} --with-otfm ${sob pdfBackend}" 39 - + " --with-js_of_ocaml ${sob htmlcBackend}" 40 - + " --with-cairo2 false"; 39 + + " --with-uutf ${boolToString pdfBackend}" 40 + + " --with-otfm ${boolToString pdfBackend}" 41 + + " --with-js_of_ocaml ${boolToString htmlcBackend}" 42 + + " --with-cairo2 false"; 41 43 42 44 inherit (topkg) installPhase; 43 45 44 - meta = with stdenv.lib; { 46 + meta = { 45 47 description = "Declarative 2D vector graphics for OCaml"; 46 48 longDescription = '' 47 49 Vg is an OCaml module for declarative 2D vector graphics. In Vg, images