aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalte Brandy <malte.brandy@maralorn.de>2020-10-14 01:46:17 +0200
committerMalte Brandy <malte.brandy@maralorn.de>2020-10-14 01:46:17 +0200
commitcebf9198f3fe80fa38a8c57eb3b02ac4c1df3e8a (patch)
treea63c3fb3954ecfd407aa649f777f102a262a4ddb
parent74d875206a825007e27abaa7c590f4c1db35ad31 (diff)
treewide: De-inline uses of lib.boolToString
This commit should not change eval results
-rw-r--r--lib/types.nix2
-rw-r--r--nixos/modules/services/mail/rspamd.nix2
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix2
-rw-r--r--nixos/modules/services/networking/prosody.nix2
-rw-r--r--nixos/modules/services/security/fail2ban.nix4
-rw-r--r--nixos/modules/services/security/usbguard.nix4
-rw-r--r--nixos/modules/services/x11/display-managers/gdm.nix2
-rw-r--r--nixos/modules/services/x11/display-managers/sddm.nix4
-rw-r--r--pkgs/applications/misc/razergenie/default.nix4
-rw-r--r--pkgs/applications/video/obs-studio/wlrobs.nix4
-rw-r--r--pkgs/development/go-modules/generic/default.nix2
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/default.nix3
-rw-r--r--pkgs/development/libraries/geoclue/default.nix2
-rw-r--r--pkgs/development/libraries/glib/default.nix2
-rw-r--r--pkgs/development/libraries/libsoup/default.nix4
-rw-r--r--pkgs/development/libraries/mesa/default.nix4
-rw-r--r--pkgs/development/libraries/v8/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/uchar/default.nix4
-rw-r--r--pkgs/os-specific/linux/dpdk/default.nix2
-rw-r--r--pkgs/tools/networking/network-manager/libnma/default.nix3
20 files changed, 30 insertions, 28 deletions
diff --git a/lib/types.nix b/lib/types.nix
index e9e45dc25c72..30b053db486f 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -499,7 +499,7 @@ rec {
show = v:
if builtins.isString v then ''"${v}"''
else if builtins.isInt v then builtins.toString v
- else if builtins.isBool v then if v then "true" else "false"
+ else if builtins.isBool v then boolToString v
else ''<${builtins.typeOf v}>'';
in
mkOptionType rec {
diff --git a/nixos/modules/services/mail/rspamd.nix b/nixos/modules/services/mail/rspamd.nix
index aacdbe2aeed2..86a3f52107d5 100644
--- a/nixos/modules/services/mail/rspamd.nix
+++ b/nixos/modules/services/mail/rspamd.nix
@@ -153,7 +153,7 @@ let
${concatStringsSep "\n" (mapAttrsToList (name: value: let
includeName = if name == "rspamd_proxy" then "proxy" else name;
- tryOverride = if value.extraConfig == "" then "true" else "false";
+ tryOverride = boolToString (value.extraConfig == "");
in ''
worker "${value.type}" {
type = "${value.type}";
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index 2680b1cc0d3b..ed05882a6343 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -45,7 +45,7 @@ let
trusted-substituters = ${toString cfg.trustedBinaryCaches}
trusted-public-keys = ${toString cfg.binaryCachePublicKeys}
auto-optimise-store = ${boolToString cfg.autoOptimiseStore}
- require-sigs = ${if cfg.requireSignedBinaryCaches then "true" else "false"}
+ require-sigs = ${boolToString cfg.requireSignedBinaryCaches}
trusted-users = ${toString cfg.trustedUsers}
allowed-users = ${toString cfg.allowedUsers}
${optionalString (!cfg.distributedBuilds) ''
diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix
index a6c1cb0f4797..e7a7aa700be6 100644
--- a/nixos/modules/services/networking/prosody.nix
+++ b/nixos/modules/services/networking/prosody.nix
@@ -261,7 +261,7 @@ let
toLua = x:
if builtins.isString x then ''"${x}"''
- else if builtins.isBool x then (if x == true then "true" else "false")
+ else if builtins.isBool x then boolToString x
else if builtins.isInt x then toString x
else if builtins.isList x then ''{ ${lib.concatStringsSep ", " (map (n: toLua n) x) } }''
else throw "Invalid Lua value";
diff --git a/nixos/modules/services/security/fail2ban.nix b/nixos/modules/services/security/fail2ban.nix
index 3f84f9c2560c..cf0d72d5c531 100644
--- a/nixos/modules/services/security/fail2ban.nix
+++ b/nixos/modules/services/security/fail2ban.nix
@@ -282,12 +282,12 @@ in
services.fail2ban.jails.DEFAULT = ''
${optionalString cfg.bantime-increment.enable ''
# Bantime incremental
- bantime.increment = ${if cfg.bantime-increment.enable then "true" else "false"}
+ bantime.increment = ${boolToString cfg.bantime-increment.enable}
bantime.maxtime = ${cfg.bantime-increment.maxtime}
bantime.factor = ${cfg.bantime-increment.factor}
bantime.formula = ${cfg.bantime-increment.formula}
bantime.multipliers = ${cfg.bantime-increment.multipliers}
- bantime.overalljails = ${if cfg.bantime-increment.overalljails then "true" else "false"}
+ bantime.overalljails = ${boolToString cfg.bantime-increment.overalljails}
''}
# Miscellaneous options
ignoreip = 127.0.0.1/8 ${optionalString config.networking.enableIPv6 "::1"} ${concatStringsSep " " cfg.ignoreIP}
diff --git a/nixos/modules/services/security/usbguard.nix b/nixos/modules/services/security/usbguard.nix
index 16a90da52314..71fd71a2cab2 100644
--- a/nixos/modules/services/security/usbguard.nix
+++ b/nixos/modules/services/security/usbguard.nix
@@ -19,13 +19,13 @@ let
PresentDevicePolicy=${cfg.presentDevicePolicy}
PresentControllerPolicy=${cfg.presentControllerPolicy}
InsertedDevicePolicy=${cfg.insertedDevicePolicy}
- RestoreControllerDeviceState=${if cfg.restoreControllerDeviceState then "true" else "false"}
+ RestoreControllerDeviceState=${boolToString cfg.restoreControllerDeviceState}
# this does not seem useful for endusers to change
DeviceManagerBackend=uevent
IPCAllowedUsers=${concatStringsSep " " cfg.IPCAllowedUsers}
IPCAllowedGroups=${concatStringsSep " " cfg.IPCAllowedGroups}
IPCAccessControlFiles=/var/lib/usbguard/IPCAccessControl.d/
- DeviceRulesWithPort=${if cfg.deviceRulesWithPort then "true" else "false"}
+ DeviceRulesWithPort=${boolToString cfg.deviceRulesWithPort}
# HACK: that way audit logs still land in the journal
AuditFilePath=/dev/null
'';
diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix
index eae70a57c781..25b424e485f3 100644
--- a/nixos/modules/services/x11/display-managers/gdm.nix
+++ b/nixos/modules/services/x11/display-managers/gdm.nix
@@ -264,7 +264,7 @@ in
# presented and there's a little delay.
environment.etc."gdm/custom.conf".text = ''
[daemon]
- WaylandEnable=${if cfg.gdm.wayland then "true" else "false"}
+ WaylandEnable=${boolToString cfg.gdm.wayland}
${optionalString cfg.autoLogin.enable (
if cfg.gdm.autoLogin.delay > 0 then ''
TimedLoginEnable=true
diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix
index e63bb2e44539..4040b903426b 100644
--- a/nixos/modules/services/x11/display-managers/sddm.nix
+++ b/nixos/modules/services/x11/display-managers/sddm.nix
@@ -55,10 +55,10 @@ let
XauthPath=${pkgs.xorg.xauth}/bin/xauth
DisplayCommand=${Xsetup}
DisplayStopCommand=${Xstop}
- EnableHidpi=${if cfg.enableHidpi then "true" else "false"}
+ EnableHidpi=${boolToString cfg.enableHidpi}
[Wayland]
- EnableHidpi=${if cfg.enableHidpi then "true" else "false"}
+ EnableHidpi=${boolToString cfg.enableHidpi}
SessionDir=${dmcfg.sessionData.desktops}/share/wayland-sessions
${optionalString dmcfg.autoLogin.enable ''
diff --git a/pkgs/applications/misc/razergenie/default.nix b/pkgs/applications/misc/razergenie/default.nix
index 9042ab38e758..ac0f373dc93d 100644
--- a/pkgs/applications/misc/razergenie/default.nix
+++ b/pkgs/applications/misc/razergenie/default.nix
@@ -27,8 +27,8 @@ in stdenv.mkDerivation {
];
mesonFlags = [
- "-Denable_experimental=${if enableExperimental then "true" else "false"}"
- "-Dinclude_matrix_discovery=${if includeMatrixDiscovery then "true" else "false"}"
+ "-Denable_experimental=${lib.boolToString enableExperimental}"
+ "-Dinclude_matrix_discovery=${lib.boolToString includeMatrixDiscovery}"
];
meta = with lib; {
diff --git a/pkgs/applications/video/obs-studio/wlrobs.nix b/pkgs/applications/video/obs-studio/wlrobs.nix
index 99486a9ccc0c..14bc80dd3880 100644
--- a/pkgs/applications/video/obs-studio/wlrobs.nix
+++ b/pkgs/applications/video/obs-studio/wlrobs.nix
@@ -7,7 +7,7 @@
# ln -s ~/.nix-profile/share/obs/obs-plugins/wlrobs/bin/64bit/libwlrobs.so ~/.config/obs-studio/plugins/wlrobs/bin/64bit
{ stdenv, fetchhg, wayland, obs-studio
, meson, ninja, pkgconfig, libX11
-, dmabufSupport ? false, libdrm ? null, libGL ? null}:
+, dmabufSupport ? false, libdrm ? null, libGL ? null, lib}:
assert dmabufSupport -> libdrm != null && libGL != null;
@@ -29,7 +29,7 @@ stdenv.mkDerivation {
'';
mesonFlags = [
- "-Duse_dmabuf=${if dmabufSupport then "true" else "false"}"
+ "-Duse_dmabuf=${lib.boolToString dmabufSupport}"
];
meta = with stdenv.lib; {
diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix
index 7db4992d1d61..9efaa8608323 100644
--- a/pkgs/development/go-modules/generic/default.nix
+++ b/pkgs/development/go-modules/generic/default.nix
@@ -47,7 +47,7 @@ let
removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}'';
- deleteFlag = if deleteVendor then "true" else "false";
+ deleteFlag = lib.boolToString deleteVendor;
vendCommand = if runVend then "${vend}/bin/vend" else "false";
diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix
index 08b8f70b2d9a..1f4bc5c12ada 100644
--- a/pkgs/development/libraries/gdk-pixbuf/default.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -21,6 +21,7 @@
, doCheck ? false
, makeWrapper
, fetchpatch
+, lib
}:
stdenv.mkDerivation rec {
@@ -74,7 +75,7 @@ stdenv.mkDerivation rec {
mesonFlags = [
"-Ddocs=true"
"-Dx11=false" # use gdk-pixbuf-xlib
- "-Dgir=${if gobject-introspection != null then "true" else "false"}"
+ "-Dgir=${lib.boolToString (gobject-introspection != null)}"
"-Dgio_sniffing=false"
];
diff --git a/pkgs/development/libraries/geoclue/default.nix b/pkgs/development/libraries/geoclue/default.nix
index da76c6dfedcf..74d778c5c555 100644
--- a/pkgs/development/libraries/geoclue/default.nix
+++ b/pkgs/development/libraries/geoclue/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
mesonFlags = [
"-Dsystemd-system-unit-dir=${placeholder "out"}/etc/systemd/system"
- "-Ddemo-agent=${if withDemoAgent then "true" else "false"}"
+ "-Ddemo-agent=${boolToString withDemoAgent}"
"--sysconfdir=/etc"
"-Dsysconfdir_install=${placeholder "out"}/etc"
"-Ddbus-srv-user=geoclue"
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 88848deec412..df19b9fc88cc 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -108,7 +108,7 @@ stdenv.mkDerivation rec {
mesonFlags = [
# Avoid the need for gobject introspection binaries in PATH in cross-compiling case.
# Instead we just copy them over from the native output.
- "-Dgtk_doc=${if stdenv.hostPlatform == stdenv.buildPlatform then "true" else "false"}"
+ "-Dgtk_doc=${boolToString (stdenv.hostPlatform == stdenv.buildPlatform)}"
"-Dnls=enabled"
"-Ddevbindir=${placeholder ''dev''}/bin"
];
diff --git a/pkgs/development/libraries/libsoup/default.nix b/pkgs/development/libraries/libsoup/default.nix
index a497661725b1..9f4a5bac25bf 100644
--- a/pkgs/development/libraries/libsoup/default.nix
+++ b/pkgs/development/libraries/libsoup/default.nix
@@ -1,6 +1,6 @@
{ stdenv, fetchurl, glib, libxml2, meson, ninja, pkgconfig, gnome3
, gnomeSupport ? true, sqlite, glib-networking, gobject-introspection, vala
-, libpsl, python3, brotli }:
+, libpsl, python3, brotli, lib }:
stdenv.mkDerivation rec {
pname = "libsoup";
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
"-Dtls_check=false" # glib-networking is a runtime dependency, not a compile-time dependency
"-Dgssapi=disabled"
"-Dvapi=enabled"
- "-Dgnome=${if gnomeSupport then "true" else "false"}"
+ "-Dgnome=${lib.boolToString gnomeSupport}"
"-Dntlm=disabled"
];
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index cf452fded14e..756a6fd15087 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -129,7 +129,7 @@ stdenv.mkDerivation {
"-Domx-libs-path=${placeholder "drivers"}/lib/bellagio"
"-Dva-libs-path=${placeholder "drivers"}/lib/dri"
"-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d"
- "-Dgallium-nine=${if enableGalliumNine then "true" else "false"}" # Direct3D in Wine
+ "-Dgallium-nine=${boolToString enableGalliumNine}" # Direct3D in Wine
"-Dosmesa=${if enableOSMesa then "gallium" else "none"}" # used by wine
] ++ optionals stdenv.isLinux [
"-Dglvnd=true"
@@ -229,7 +229,7 @@ stdenv.mkDerivation {
inherit (libglvnd) driverLink;
};
- meta = with stdenv.lib; {
+ meta = {
description = "An open source 3D graphics library";
longDescription = ''
The Mesa project began as an open-source implementation of the OpenGL
diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix
index 60e856e61dfe..e6696626cb5d 100644
--- a/pkgs/development/libraries/v8/default.nix
+++ b/pkgs/development/libraries/v8/default.nix
@@ -80,7 +80,7 @@ stdenv.mkDerivation rec {
gnFlags = [
"use_custom_libcxx=false"
- "is_clang=${if stdenv.cc.isClang then "true" else "false"}"
+ "is_clang=${lib.boolToString stdenv.cc.isClang}"
"use_sysroot=false"
# "use_system_icu=true"
"is_component_build=false"
diff --git a/pkgs/development/ocaml-modules/uchar/default.nix b/pkgs/development/ocaml-modules/uchar/default.nix
index 819d8527b2a5..fb56cca0f0a7 100644
--- a/pkgs/development/ocaml-modules/uchar/default.nix
+++ b/pkgs/development/ocaml-modules/uchar/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opaline, withShared ? true }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opaline, withShared ? true, lib }:
stdenv.mkDerivation {
name = "ocaml${ocaml.version}-uchar-0.0.2";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
nativeBuildInputs = [ ocaml ocamlbuild findlib ];
buildInputs = [ findlib ocaml ocamlbuild ];
- buildPhase = "ocaml pkg/build.ml native=true native-dynlink=${if withShared then "true" else "false"}";
+ buildPhase = "ocaml pkg/build.ml native=true native-dynlink=${lib.boolToString withShared}";
installPhase = "${opaline}/bin/opaline -libdir $OCAMLFIND_DESTDIR";
configurePlatforms = [];
diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix
index aacbc3cdfbe2..efe578c596b1 100644
--- a/pkgs/os-specific/linux/dpdk/default.nix
+++ b/pkgs/os-specific/linux/dpdk/default.nix
@@ -43,7 +43,7 @@ in stdenv.mkDerivation rec {
mesonFlags = [
"-Denable_docs=true"
- "-Denable_kmods=${if mod then "true" else "false"}"
+ "-Denable_kmods=${lib.boolToString mod}"
]
++ lib.optional (!shared) "-Ddefault_library=static"
++ lib.optional stdenv.isx86_64 "-Dmachine=nehalem"
diff --git a/pkgs/tools/networking/network-manager/libnma/default.nix b/pkgs/tools/networking/network-manager/libnma/default.nix
index 7d7889f9a5bc..d50ccc6517b4 100644
--- a/pkgs/tools/networking/network-manager/libnma/default.nix
+++ b/pkgs/tools/networking/network-manager/libnma/default.nix
@@ -19,6 +19,7 @@
, gcr
, glib
, substituteAll
+, lib
}:
stdenv.mkDerivation rec {
@@ -61,7 +62,7 @@ stdenv.mkDerivation rec {
];
mesonFlags = [
- "-Dgcr=${if withGnome then "true" else "false"}"
+ "-Dgcr=${lib.boolToString withGnome}"
];
postPatch = ''