···3030 /* boolean “and” */
3131 and = x: y: x && y;
32323333+ /* Convert a boolean to a string.
3434+ Note that toString on a bool returns "1" and "".
3535+ */
3636+ boolToString = b: if b then "true" else "false";
3737+3338 /* Merge two attribute sets shallowly, right side trumps left
34393540 Example:
···55let
66 cfg = config.fonts.fontconfig;
7788- fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
88+ fcBool = x: "<bool>" + (boolToString x) + "</bool>";
991010 # back-supported fontconfig version and package
1111 # version is used for font cache generation
+1-1
nixos/modules/config/fonts/fontconfig.nix
···20202121let cfg = config.fonts.fontconfig;
22222323- fcBool = x: "<bool>" + (if x then "true" else "false") + "</bool>";
2323+ fcBool = x: "<bool>" + (boolToString x) + "</bool>";
24242525 # back-supported fontconfig version and package
2626 # version is used for font cache generation
···99 extmapFile = pkgs.writeText "extmap.conf" cfg.extmap;
10101111 afpToString = x: if builtins.typeOf x == "bool"
1212- then (if x then "true" else "false")
1212+ then boolToString x
1313 else toString x;
14141515 volumeConfig = name:
···55let
6677 smbToString = x: if builtins.typeOf x == "bool"
88- then (if x then "true" else "false")
88+ then boolToString x
99 else toString x;
10101111 cfg = config.services.samba;
···1010 # repeatedArgs (arg: "--arg=${arg}") args
1111 repeatedArgs = concatMapStringsSep " ";
12121313- # 'toString' doesn't quite do what we want for bools.
1414- fromBool = x: if x then "true" else "false";
1515-1613 # oauth2_proxy provides many options that are only relevant if you are using
1714 # a certain provider. This set maps from provider name to a function that
1815 # takes the configuration and returns a string that can be inserted into the
···4946 --client-secret='${cfg.clientSecret}' \
5047 ${optionalString (!isNull cfg.cookie.domain) "--cookie-domain='${cfg.cookie.domain}'"} \
5148 --cookie-expire='${cfg.cookie.expire}' \
5252- --cookie-httponly=${fromBool cfg.cookie.httpOnly} \
4949+ --cookie-httponly=${boolToString cfg.cookie.httpOnly} \
5350 --cookie-name='${cfg.cookie.name}' \
5451 --cookie-secret='${cfg.cookie.secret}' \
5555- --cookie-secure=${fromBool cfg.cookie.secure} \
5252+ --cookie-secure=${boolToString cfg.cookie.secure} \
5653 ${optionalString (!isNull cfg.cookie.refresh) "--cookie-refresh='${cfg.cookie.refresh}'"} \
5754 ${optionalString (!isNull cfg.customTemplatesDir) "--custom-templates-dir='${cfg.customTemplatesDir}'"} \
5855 ${repeatedArgs (x: "--email-domain='${x}'") cfg.email.domains} \
5956 --http-address='${cfg.httpAddress}' \
6060- ${optionalString (!isNull cfg.htpasswd.file) "--htpasswd-file='${cfg.htpasswd.file}' --display-htpasswd-form=${fromBool cfg.htpasswd.displayForm}"} \
5757+ ${optionalString (!isNull cfg.htpasswd.file) "--htpasswd-file='${cfg.htpasswd.file}' --display-htpasswd-form=${boolToString cfg.htpasswd.displayForm}"} \
6158 ${optionalString (!isNull cfg.loginURL) "--login-url='${cfg.loginURL}'"} \
6262- --pass-access-token=${fromBool cfg.passAccessToken} \
6363- --pass-basic-auth=${fromBool cfg.passBasicAuth} \
6464- --pass-host-header=${fromBool cfg.passHostHeader} \
5959+ --pass-access-token=${boolToString cfg.passAccessToken} \
6060+ --pass-basic-auth=${boolToString cfg.passBasicAuth} \
6161+ --pass-host-header=${boolToString cfg.passHostHeader} \
6562 --proxy-prefix='${cfg.proxyPrefix}' \
6663 ${optionalString (!isNull cfg.profileURL) "--profile-url='${cfg.profileURL}'"} \
6764 ${optionalString (!isNull cfg.redeemURL) "--redeem-url='${cfg.redeemURL}'"} \
6865 ${optionalString (!isNull cfg.redirectURL) "--redirect-url='${cfg.redirectURL}'"} \
6969- --request-logging=${fromBool cfg.requestLogging} \
6666+ --request-logging=${boolToString cfg.requestLogging} \
7067 ${optionalString (!isNull cfg.scope) "--scope='${cfg.scope}'"} \
7168 ${repeatedArgs (x: "--skip-auth-regex='${x}'") cfg.skipAuthRegexes} \
7269 ${optionalString (!isNull cfg.signatureKey) "--signature-key='${cfg.signatureKey}'"} \
+1-2
nixos/modules/services/torrent/transmission.nix
···15151616 # Strings must be quoted, ints and bools must not (for settings.json).
1717 toOption = x:
1818- if x == true then "true"
1919- else if x == false then "false"
1818+ if isBool x then boolToString x
2019 else if isInt x then toString x
2120 else toString ''"${x}"'';
2221
···1212 port: ${toString cfg.quasselCorePort}, // quasselcore port
1313 initialBacklogLimit: ${toString cfg.initialBacklogLimit}, // Amount of backlogs to fetch per buffer on connection
1414 backlogLimit: ${toString cfg.backlogLimit}, // Amount of backlogs to fetch per buffer after first retrieval
1515- securecore: ${if cfg.secureCore then "true" else "false"}, // Connect to the core using SSL
1515+ securecore: ${boolToString cfg.secureCore}, // Connect to the core using SSL
1616 theme: '${cfg.theme}' // Default UI theme
1717 },
1818 themes: ['default', 'darksolarized'], // Available themes
1919- 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
1919+ forcedefault: ${boolToString cfg.forceHostAndPort}, // Will force default host and port to be used, and will hide the corresponding fields in the UI
2020 prefixpath: '${cfg.prefixPath}' // Configure this if you use a reverse proxy
2121 };
2222 '';
-2
nixos/modules/services/web-apps/tt-rss.nix
···6677 configVersion = 26;
8899- boolToString = b: if b then "true" else "false";
1010-119 cacheDir = "cache";
1210 lockDir = "lock";
1311 feedIconsDir = "feed-icons";