diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2017-04-11 18:08:51 +0200 |
---|---|---|
committer | Franz Pletz <fpletz@fnordicwalking.de> | 2017-04-11 18:18:53 +0200 |
commit | 3ab45f4b369c9c741b55ddedeaac4c797dc61c04 (patch) | |
tree | 3c5e330622e42066e50ab20a6c58b9251addf863 /nixos/modules | |
parent | 54fff9ec1a9e7425926eadffada0268351536926 (diff) |
treewide: use boolToString function
Diffstat (limited to 'nixos/modules')
34 files changed, 89 insertions, 105 deletions
diff --git a/nixos/modules/config/fonts/fontconfig-penultimate.nix b/nixos/modules/config/fonts/fontconfig-penultimate.nix index 83d6532774e3..3e163b8ec51e 100644 --- a/nixos/modules/config/fonts/fontconfig-penultimate.nix +++ b/nixos/modules/config/fonts/fontconfig-penultimate.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.fonts.fontconfig; - fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>"; + fcBool = x: "<bool>" + (boolToString x) + "</bool>"; # back-supported fontconfig version and package # version is used for font cache generation diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index d44b583447a3..12f5ca2e7993 100644 --- a/nixos/modules/config/fonts/fontconfig.nix +++ b/nixos/modules/config/fonts/fontconfig.nix @@ -20,7 +20,7 @@ with lib; let cfg = config.fonts.fontconfig; - fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>"; + fcBool = x: "<bool>" + (boolToString x) + "</bool>"; # back-supported fontconfig version and package # version is used for font cache generation diff --git a/nixos/modules/services/cluster/kubernetes.nix b/nixos/modules/services/cluster/kubernetes.nix index 9ccc7295019a..bf7b44c698cb 100644 --- a/nixos/modules/services/cluster/kubernetes.nix +++ b/nixos/modules/services/cluster/kubernetes.nix @@ -612,8 +612,8 @@ in { --require-kubeconfig \ --address=${cfg.kubelet.address} \ --port=${toString cfg.kubelet.port} \ - --register-node=${if cfg.kubelet.registerNode then "true" else "false"} \ - --register-schedulable=${if cfg.kubelet.registerSchedulable then "true" else "false"} \ + --register-node=${boolToString cfg.kubelet.registerNode} \ + --register-schedulable=${boolToString cfg.kubelet.registerSchedulable} \ ${optionalString (cfg.kubelet.tlsCertFile != null) "--tls-cert-file=${cfg.kubelet.tlsCertFile}"} \ ${optionalString (cfg.kubelet.tlsKeyFile != null) @@ -621,7 +621,7 @@ in { --healthz-bind-address=${cfg.kubelet.healthz.bind} \ --healthz-port=${toString cfg.kubelet.healthz.port} \ --hostname-override=${cfg.kubelet.hostname} \ - --allow-privileged=${if cfg.kubelet.allowPrivileged then "true" else "false"} \ + --allow-privileged=${boolToString cfg.kubelet.allowPrivileged} \ --root-dir=${cfg.dataDir} \ --cadvisor_port=${toString cfg.kubelet.cadvisorPort} \ ${optionalString (cfg.kubelet.clusterDns != "") @@ -670,14 +670,14 @@ in { --bind-address=0.0.0.0 \ ${optionalString (cfg.apiserver.advertiseAddress != null) "--advertise-address=${cfg.apiserver.advertiseAddress}"} \ - --allow-privileged=${if cfg.apiserver.allowPrivileged then "true" else "false"} \ + --allow-privileged=${boolToString cfg.apiserver.allowPrivileged}\ ${optionalString (cfg.apiserver.tlsCertFile != null) "--tls-cert-file=${cfg.apiserver.tlsCertFile}"} \ ${optionalString (cfg.apiserver.tlsKeyFile != null) "--tls-private-key-file=${cfg.apiserver.tlsKeyFile}"} \ ${optionalString (cfg.apiserver.tokenAuth != null) "--token-auth-file=${cfg.apiserver.tokenAuth}"} \ - --kubelet-https=${if cfg.apiserver.kubeletHttps then "true" else "false"} \ + --kubelet-https=${boolToString cfg.apiserver.kubeletHttps} \ ${optionalString (cfg.apiserver.kubeletClientCaFile != null) "--kubelet-certificate-authority=${cfg.apiserver.kubeletClientCaFile}"} \ ${optionalString (cfg.apiserver.kubeletClientCertFile != null) @@ -719,7 +719,7 @@ in { ExecStart = ''${cfg.package}/bin/kube-scheduler \ --address=${cfg.scheduler.address} \ --port=${toString cfg.scheduler.port} \ - --leader-elect=${if cfg.scheduler.leaderElect then "true" else "false"} \ + --leader-elect=${boolToString cfg.scheduler.leaderElect} \ --kubeconfig=${kubeconfig} \ ${optionalString cfg.verbose "--v=6"} \ ${optionalString cfg.verbose "--log-flush-frequency=1s"} \ @@ -744,7 +744,7 @@ in { --address=${cfg.controllerManager.address} \ --port=${toString cfg.controllerManager.port} \ --kubeconfig=${kubeconfig} \ - --leader-elect=${if cfg.controllerManager.leaderElect then "true" else "false"} \ + --leader-elect=${boolToString cfg.controllerManager.leaderElect} \ ${if (cfg.controllerManager.serviceAccountKeyFile!=null) then "--service-account-private-key-file=${cfg.controllerManager.serviceAccountKeyFile}" else "--service-account-private-key-file=/var/run/kubernetes/apiserver.key"} \ diff --git a/nixos/modules/services/continuous-integration/hydra/default.nix b/nixos/modules/services/continuous-integration/hydra/default.nix index fa550f68b338..57f592a2e550 100644 --- a/nixos/modules/services/continuous-integration/hydra/default.nix +++ b/nixos/modules/services/continuous-integration/hydra/default.nix @@ -328,7 +328,7 @@ in IN_SYSTEMD = "1"; # to get log severity levels }; serviceConfig = - { ExecStart = "@${cfg.package}/bin/hydra-queue-runner hydra-queue-runner -v --option build-use-substitutes ${if cfg.useSubstitutes then "true" else "false"}"; + { ExecStart = "@${cfg.package}/bin/hydra-queue-runner hydra-queue-runner -v --option build-use-substitutes ${boolToString cfg.useSubstitutes}"; ExecStopPost = "${cfg.package}/bin/hydra-queue-runner --unlock"; User = "hydra-queue-runner"; Restart = "always"; diff --git a/nixos/modules/services/databases/cassandra.nix b/nixos/modules/services/databases/cassandra.nix index 5df4ae57f809..1e5cd8f54130 100644 --- a/nixos/modules/services/databases/cassandra.nix +++ b/nixos/modules/services/databases/cassandra.nix @@ -21,8 +21,8 @@ let cassandraConf = '' cluster_name: ${cfg.clusterName} num_tokens: 256 - auto_bootstrap: ${if cfg.autoBootstrap then "true" else "false"} - hinted_handoff_enabled: ${if cfg.hintedHandOff then "true" else "false"} + auto_bootstrap: ${boolToString cfg.autoBootstrap} + hinted_handoff_enabled: ${boolToString cfg.hintedHandOff} hinted_handoff_throttle_in_kb: ${builtins.toString cfg.hintedHandOffThrottle} max_hints_delivery_threads: 2 max_hint_window_in_ms: 10800000 # 3 hours @@ -62,7 +62,7 @@ let rpc_keepalive: true rpc_server_type: sync thrift_framed_transport_size_in_mb: 15 - incremental_backups: ${if cfg.incrementalBackups then "true" else "false"} + incremental_backups: ${boolToString cfg.incrementalBackups} snapshot_before_compaction: false auto_snapshot: true column_index_size_in_kb: 64 @@ -89,7 +89,7 @@ let truststore: ${cfg.trustStorePath} truststore_password: ${cfg.trustStorePassword} client_encryption_options: - enabled: ${if cfg.clientEncryption then "true" else "false"} + enabled: ${boolToString cfg.clientEncryption} keystore: ${cfg.keyStorePath} keystore_password: ${cfg.keyStorePassword} internode_compression: all diff --git a/nixos/modules/services/databases/mongodb.nix b/nixos/modules/services/databases/mongodb.nix index 38e46a0c6ef9..c56564f57f36 100644 --- a/nixos/modules/services/databases/mongodb.nix +++ b/nixos/modules/services/databases/mongodb.nix @@ -4,8 +4,6 @@ with lib; let - b2s = x: if x then "true" else "false"; - cfg = config.services.mongodb; mongodb = cfg.package; diff --git a/nixos/modules/services/logging/graylog.nix b/nixos/modules/services/logging/graylog.nix index 95283096662e..9f0fb11f0252 100644 --- a/nixos/modules/services/logging/graylog.nix +++ b/nixos/modules/services/logging/graylog.nix @@ -4,16 +4,15 @@ with lib; let cfg = config.services.graylog; - configBool = b: if b then "true" else "false"; confFile = pkgs.writeText "graylog.conf" '' - is_master = ${configBool cfg.isMaster} + is_master = ${boolToString cfg.isMaster} node_id_file = ${cfg.nodeIdFile} password_secret = ${cfg.passwordSecret} root_username = ${cfg.rootUsername} root_password_sha2 = ${cfg.rootPasswordSha2} elasticsearch_cluster_name = ${cfg.elasticsearchClusterName} - elasticsearch_discovery_zen_ping_multicast_enabled = ${configBool cfg.elasticsearchDiscoveryZenPingMulticastEnabled} + elasticsearch_discovery_zen_ping_multicast_enabled = ${boolToString cfg.elasticsearchDiscoveryZenPingMulticastEnabled} elasticsearch_discovery_zen_ping_unicast_hosts = ${cfg.elasticsearchDiscoveryZenPingUnicastHosts} message_journal_dir = ${cfg.messageJournalDir} mongodb_uri = ${cfg.mongodbUri} diff --git a/nixos/modules/services/misc/cgminer.nix b/nixos/modules/services/misc/cgminer.nix index 5f97cc034148..d5071d8ff767 100644 --- a/nixos/modules/services/misc/cgminer.nix +++ b/nixos/modules/services/misc/cgminer.nix @@ -6,7 +6,7 @@ let cfg = config.services.cgminer; convType = with builtins; - v: if isBool v then (if v then "true" else "false") else toString v; + v: if isBool v then boolToString v else toString v; mergedHwConfig = mapAttrsToList (n: v: ''"${n}": "${(concatStringsSep "," (map convType v))}"'') (foldAttrs (n: a: [n] ++ a) [] cfg.hardware); diff --git a/nixos/modules/services/misc/confd.nix b/nixos/modules/services/misc/confd.nix index fe13013286b8..8e9bec15dd4f 100755 --- a/nixos/modules/services/misc/confd.nix +++ b/nixos/modules/services/misc/confd.nix @@ -12,7 +12,7 @@ let nodes = [ ${concatMapStringsSep "," (s: ''"${s}"'') cfg.nodes}, ] prefix = "${cfg.prefix}" log-level = "${cfg.logLevel}" - watch = ${if cfg.watch then "true" else "false"} + watch = ${boolToString cfg.watch} ''; in { diff --git a/nixos/modules/services/misc/matrix-synapse.nix b/nixos/modules/services/misc/matrix-synapse.nix index 4a1bea50c14e..ae9826968b1f 100644 --- a/nixos/modules/services/misc/matrix-synapse.nix +++ b/nixos/modules/services/misc/matrix-synapse.nix @@ -5,9 +5,8 @@ with lib; let cfg = config.services.matrix-synapse; logConfigFile = pkgs.writeText "log_config.yaml" cfg.logConfig; - mkResource = r: ''{names: ${builtins.toJSON r.names}, compress: ${fromBool r.compress}}''; - 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)}]}''; - fromBool = x: if x then "true" else "false"; + mkResource = r: ''{names: ${builtins.toJSON r.names}, compress: ${boolToString r.compress}}''; + 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)}]}''; configFile = pkgs.writeText "homeserver.yaml" '' ${optionalString (cfg.tls_certificate_path != null) '' tls_certificate_path: "${cfg.tls_certificate_path}" @@ -18,7 +17,7 @@ tls_private_key_path: "${cfg.tls_private_key_path}" ${optionalString (cfg.tls_dh_params_path != null) '' tls_dh_params_path: "${cfg.tls_dh_params_path}" ''} -no_tls: ${fromBool cfg.no_tls} +no_tls: ${boolToString cfg.no_tls} ${optionalString (cfg.bind_port != null) '' bind_port: ${toString cfg.bind_port} ''} @@ -30,7 +29,7 @@ bind_host: "${cfg.bind_host}" ''} server_name: "${cfg.server_name}" pid_file: "/var/run/matrix-synapse.pid" -web_client: ${fromBool cfg.web_client} +web_client: ${boolToString cfg.web_client} ${optionalString (cfg.public_baseurl != null) '' public_baseurl: "${cfg.public_baseurl}" ''} @@ -58,8 +57,8 @@ media_store_path: "/var/lib/matrix-synapse/media" uploads_path: "/var/lib/matrix-synapse/uploads" max_upload_size: "${cfg.max_upload_size}" max_image_pixels: "${cfg.max_image_pixels}" -dynamic_thumbnails: ${fromBool cfg.dynamic_thumbnails} -url_preview_enabled: ${fromBool cfg.url_preview_enabled} +dynamic_thumbnails: ${boolToString cfg.dynamic_thumbnails} +url_preview_enabled: ${boolToString cfg.url_preview_enabled} ${optionalString (cfg.url_preview_enabled == true) '' url_preview_ip_range_blacklist: ${builtins.toJSON cfg.url_preview_ip_range_blacklist} url_preview_ip_range_whitelist: ${builtins.toJSON cfg.url_preview_ip_range_whitelist} @@ -67,10 +66,10 @@ url_preview_url_blacklist: ${builtins.toJSON cfg.url_preview_url_blacklist} ''} recaptcha_private_key: "${cfg.recaptcha_private_key}" recaptcha_public_key: "${cfg.recaptcha_public_key}" -enable_registration_captcha: ${fromBool cfg.enable_registration_captcha} +enable_registration_captcha: ${boolToString cfg.enable_registration_captcha} turn_uris: ${builtins.toJSON cfg.turn_uris} turn_shared_secret: "${cfg.turn_shared_secret}" -enable_registration: ${fromBool cfg.enable_registration} +enable_registration: ${boolToString cfg.enable_registration} ${optionalString (cfg.registration_shared_secret != null) '' registration_shared_secret: "${cfg.registration_shared_secret}" ''} @@ -78,15 +77,15 @@ recaptcha_siteverify_api: "https://www.google.com/recaptcha/api/siteverify" turn_user_lifetime: "${cfg.turn_user_lifetime}" user_creation_max_duration: ${cfg.user_creation_max_duration} bcrypt_rounds: ${cfg.bcrypt_rounds} -allow_guest_access: ${fromBool cfg.allow_guest_access} +allow_guest_access: ${boolToString cfg.allow_guest_access} trusted_third_party_id_servers: ${builtins.toJSON cfg.trusted_third_party_id_servers} room_invite_state_types: ${builtins.toJSON cfg.room_invite_state_types} ${optionalString (cfg.macaroon_secret_key != null) '' macaroon_secret_key: "${cfg.macaroon_secret_key}" ''} -expire_access_token: ${fromBool cfg.expire_access_token} -enable_metrics: ${fromBool cfg.enable_metrics} -report_stats: ${fromBool cfg.report_stats} +expire_access_token: ${boolToString cfg.expire_access_token} +enable_metrics: ${boolToString cfg.enable_metrics} +report_stats: ${boolToString cfg.report_stats} signing_key_path: "/var/lib/matrix-synapse/homeserver.signing.key" key_refresh_interval: "${cfg.key_refresh_interval}" perspectives: diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 4fe89838e29d..bf1304ee7ac2 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -41,12 +41,12 @@ let build-users-group = nixbld build-max-jobs = ${toString (cfg.maxJobs)} build-cores = ${toString (cfg.buildCores)} - build-use-sandbox = ${if (builtins.isBool cfg.useSandbox) then (if cfg.useSandbox then "true" else "false") else cfg.useSandbox} + build-use-sandbox = ${if (builtins.isBool cfg.useSandbox) then boolToString cfg.useSandbox else cfg.useSandbox} build-sandbox-paths = ${toString cfg.sandboxPaths} /bin/sh=${sh} $(echo $extraPaths) binary-caches = ${toString cfg.binaryCaches} trusted-binary-caches = ${toString cfg.trustedBinaryCaches} binary-cache-public-keys = ${toString cfg.binaryCachePublicKeys} - auto-optimise-store = ${if cfg.autoOptimiseStore then "true" else "false"} + auto-optimise-store = ${boolToString cfg.autoOptimiseStore} ${optionalString cfg.requireSignedBinaryCaches '' signed-binary-caches = * ''} diff --git a/nixos/modules/services/misc/taskserver/default.nix b/nixos/modules/services/misc/taskserver/default.nix index ba9f52f1904b..ab9a6ce32f46 100644 --- a/nixos/modules/services/misc/taskserver/default.nix +++ b/nixos/modules/services/misc/taskserver/default.nix @@ -128,7 +128,7 @@ let certBits = cfg.pki.auto.bits; clientExpiration = cfg.pki.auto.expiration.client; crlExpiration = cfg.pki.auto.expiration.crl; - isAutoConfig = if needToCreateCA then "True" else "False"; + isAutoConfig = boolToString needToCreateCA; }}" > "$out/main.py" cat > "$out/setup.py" <<EOF from setuptools import setup diff --git a/nixos/modules/services/monitoring/collectd.nix b/nixos/modules/services/monitoring/collectd.nix index 641da60e9adc..79a8a1ff5aed 100644 --- a/nixos/modules/services/monitoring/collectd.nix +++ b/nixos/modules/services/monitoring/collectd.nix @@ -8,7 +8,7 @@ let conf = pkgs.writeText "collectd.conf" '' BaseDir "${cfg.dataDir}" PIDFile "${cfg.pidFile}" - AutoLoadPlugin ${if cfg.autoLoadPlugin then "true" else "false"} + AutoLoadPlugin ${boolToString cfg.autoLoadPlugin} Hostname "${config.networking.hostName}" LoadPlugin syslog diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix index 97806d5d83eb..4fbacef788f9 100644 --- a/nixos/modules/services/monitoring/grafana.nix +++ b/nixos/modules/services/monitoring/grafana.nix @@ -5,8 +5,6 @@ with lib; let cfg = config.services.grafana; - b2s = val: if val then "true" else "false"; - envOptions = { PATHS_DATA = cfg.dataDir; PATHS_PLUGINS = "${cfg.dataDir}/plugins"; @@ -32,16 +30,16 @@ let SECURITY_ADMIN_PASSWORD = cfg.security.adminPassword; SECURITY_SECRET_KEY = cfg.security.secretKey; - USERS_ALLOW_SIGN_UP = b2s cfg.users.allowSignUp; - USERS_ALLOW_ORG_CREATE = b2s cfg.users.allowOrgCreate; - USERS_AUTO_ASSIGN_ORG = b2s cfg.users.autoAssignOrg; + USERS_ALLOW_SIGN_UP = boolToString cfg.users.allowSignUp; + USERS_ALLOW_ORG_CREATE = boolToString cfg.users.allowOrgCreate; + USERS_AUTO_ASSIGN_ORG = boolToString cfg.users.autoAssignOrg; USERS_AUTO_ASSIGN_ORG_ROLE = cfg.users.autoAssignOrgRole; - AUTH_ANONYMOUS_ENABLED = b2s cfg.auth.anonymous.enable; + AUTH_ANONYMOUS_ENABLED = boolToString cfg.auth.anonymous.enable; AUTH_ANONYMOUS_ORG_NAME = cfg.auth.anonymous.org_name; AUTH_ANONYMOUS_ORG_ROLE = cfg.auth.anonymous.org_role; - ANALYTICS_REPORTING_ENABLED = b2s cfg.analytics.reporting.enable; + ANALYTICS_REPORTING_ENABLED = boolToString cfg.analytics.reporting.enable; } // cfg.extraOptions; in { diff --git a/nixos/modules/services/network-filesystems/netatalk.nix b/nixos/modules/services/network-filesystems/netatalk.nix index bff54406a2b0..1dd869043f0c 100644 --- a/nixos/modules/services/network-filesystems/netatalk.nix +++ b/nixos/modules/services/network-filesystems/netatalk.nix @@ -9,7 +9,7 @@ let extmapFile = pkgs.writeText "extmap.conf" cfg.extmap; afpToString = x: if builtins.typeOf x == "bool" - then (if x then "true" else "false") + then boolToString x else toString x; volumeConfig = name: diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix index 6ae5292fc303..87c4f7a8ebcb 100644 --- a/nixos/modules/services/network-filesystems/samba.nix +++ b/nixos/modules/services/network-filesystems/samba.nix @@ -5,7 +5,7 @@ with lib; let smbToString = x: if builtins.typeOf x == "bool" - then (if x then "true" else "false") + then boolToString x else toString x; cfg = config.services.samba; diff --git a/nixos/modules/services/network-filesystems/tahoe.nix b/nixos/modules/services/network-filesystems/tahoe.nix index 3d78ac096a2b..9815a5434ee3 100644 --- a/nixos/modules/services/network-filesystems/tahoe.nix +++ b/nixos/modules/services/network-filesystems/tahoe.nix @@ -290,14 +290,14 @@ in shares.total = ${toString settings.client.shares.total} [storage] - enabled = ${if settings.storage.enable then "true" else "false"} + enabled = ${boolToString settings.storage.enable} reserved_space = ${settings.storage.reservedSpace} [helper] - enabled = ${if settings.helper.enable then "true" else "false"} + enabled = ${boolToString settings.helper.enable} [sftpd] - enabled = ${if settings.sftpd.enable then "true" else "false"} + enabled = ${boolToString settings.sftpd.enable} ${optionalString (settings.sftpd.port != null) "port = ${toString settings.sftpd.port}"} ${optionalString (settings.sftpd.hostPublicKeyFile != null) diff --git a/nixos/modules/services/networking/aiccu.nix b/nixos/modules/services/networking/aiccu.nix index aeb0910d6246..ac755270951b 100644 --- a/nixos/modules/services/networking/aiccu.nix +++ b/nixos/modules/services/networking/aiccu.nix @@ -5,7 +5,6 @@ with lib; let cfg = config.services.aiccu; - showBool = b: if b then "true" else "false"; notNull = a: ! isNull a; configFile = pkgs.writeText "aiccu.conf" '' ${if notNull cfg.username then "username " + cfg.username else ""} @@ -13,16 +12,16 @@ let protocol ${cfg.protocol} server ${cfg.server} ipv6_interface ${cfg.interfaceName} - verbose ${showBool cfg.verbose} + verbose ${boolToString cfg.verbose} daemonize true - automatic ${showBool cfg.automatic} - requiretls ${showBool cfg.requireTLS} + automatic ${boolToString cfg.automatic} + requiretls ${boolToString cfg.requireTLS} pidfile ${cfg.pidFile} - defaultroute ${showBool cfg.defaultRoute} + defaultroute ${boolToString cfg.defaultRoute} ${if notNull cfg.setupScript then cfg.setupScript else ""} - makebeats ${showBool cfg.makeHeartBeats} - noconfigure ${showBool cfg.noConfigure} - behindnat ${showBool cfg.behindNAT} + makebeats ${boolToString cfg.makeHeartBeats} + noconfigure ${boolToString cfg.noConfigure} + behindnat ${boolToString cfg.behindNAT} ${if cfg.localIPv4Override then "local_ipv4_override" else ""} ''; diff --git a/nixos/modules/services/networking/btsync.nix b/nixos/modules/services/networking/btsync.nix index 92e9fa7be419..6e479a5860ac 100644 --- a/nixos/modules/services/networking/btsync.nix +++ b/nixos/modules/services/networking/btsync.nix @@ -9,7 +9,6 @@ let listenAddr = cfg.httpListenAddr + ":" + (toString cfg.httpListenPort); - boolStr = x: if x then "true" else "false"; optionalEmptyStr = b: v: optionalString (b != "") v; webUIConfig = optionalString cfg.enableWebUI @@ -31,7 +30,7 @@ let sharedFoldersRecord = concatStringsSep "," (map (entry: let helper = attr: v: - if (entry ? attr) then boolStr entry.attr else boolStr v; + if (entry ? attr) then boolToString entry.attr else boolToString v; in '' { @@ -65,11 +64,11 @@ let "listening_port": ${toString cfg.listeningPort}, "use_gui": false, - "check_for_updates": ${boolStr cfg.checkForUpdates}, - "use_upnp": ${boolStr cfg.useUpnp}, + "check_for_updates": ${boolToString cfg.checkForUpdates}, + "use_upnp": ${boolToString cfg.useUpnp}, "download_limit": ${toString cfg.downloadLimit}, "upload_limit": ${toString cfg.uploadLimit}, - "lan_encrypt_data": ${boolStr cfg.encryptLAN}, + "lan_encrypt_data": ${boolToString cfg.encryptLAN}, ${webUIConfig} ${sharedFoldersConfig} diff --git a/nixos/modules/services/networking/firefox/sync-server.nix b/nixos/modules/services/networking/firefox/sync-server.nix index 5c14ceff6a0d..3a95b9c4ec94 100644 --- a/nixos/modules/services/networking/firefox/sync-server.nix +++ b/nixos/modules/services/networking/firefox/sync-server.nix @@ -19,7 +19,7 @@ let [syncserver] public_url = ${cfg.publicUrl} ${optionalString (cfg.sqlUri != "") "sqluri = ${cfg.sqlUri}"} - allow_new_users = ${if cfg.allowNewUsers then "true" else "false"} + allow_new_users = ${boolToString cfg.allowNewUsers} [browserid] backend = tokenserver.verifiers.LocalVerifier diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index c5b27350b3c2..24a3196bed46 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -10,8 +10,6 @@ let extip = "EXTIP=\$(${pkgs.curl.bin}/bin/curl -sLf \"http://jsonip.com\" | ${pkgs.gawk}/bin/awk -F'\"' '{print $4}')"; - toYesNo = b: if b then "true" else "false"; - mkEndpointOpt = name: addr: port: { enable = mkEnableOption name; name = mkOption { @@ -76,10 +74,10 @@ let i2pdConf = pkgs.writeText "i2pd.conf" '' - ipv4 = ${toYesNo cfg.enableIPv4} - ipv6 = ${toYesNo cfg.enableIPv6} - notransit = ${toYesNo cfg.notransit} - floodfill = ${toYesNo cfg.floodfill} + ipv4 = ${boolToString cfg.enableIPv4} + ipv6 = ${boolToString cfg.enableIPv6} + notransit = ${boolToString cfg.notransit} + floodfill = ${boolToString cfg.floodfill} netid = ${toString cfg.netid} ${if isNull cfg.bandwidth then "" else "bandwidth = ${toString cfg.bandwidth}" } ${if isNull cfg.port then "" else "port = ${toString cfg.port}"} @@ -88,14 +86,14 @@ let transittunnels = ${toString cfg.limits.transittunnels} [upnp] - enabled = ${toYesNo cfg.upnp.enable} + enabled = ${boolToString cfg.upnp.enable} name = ${cfg.upnp.name} [precomputation] - elgamal = ${toYesNo cfg.precomputation.elgamal} + elgamal = ${boolToString cfg.precomputation.elgamal} [reseed] - verify = ${toYesNo cfg.reseed.verify} + verify = ${boolToString cfg.reseed.verify} file = ${cfg.reseed.file} urls = ${builtins.concatStringsSep "," cfg.reseed.urls} @@ -107,11 +105,11 @@ let (proto: let portStr = t |