treewide: Remove usage of isNull

isNull "is deprecated; just write e == null instead" says the Nix manual
This commit is contained in:
Daniel Schaefer 2019-04-24 05:48:22 +02:00
parent 5f14e83bd6
commit 786f02f7a4
52 changed files with 89 additions and 95 deletions

View file

@ -178,7 +178,7 @@ rec {
toPlist = {}: v: let toPlist = {}: v: let
isFloat = builtins.isFloat or (x: false); isFloat = builtins.isFloat or (x: false);
expr = ind: x: with builtins; expr = ind: x: with builtins;
if isNull x then "" else if x == null then "" else
if isBool x then bool ind x else if isBool x then bool ind x else
if isInt x then int ind x else if isInt x then int ind x else
if isString x then str ind x else if isString x then str ind x else

View file

@ -83,7 +83,7 @@ rec {
# Sometimes git stores the commitId directly in the file but # Sometimes git stores the commitId directly in the file but
# sometimes it stores something like: «ref: refs/heads/branch-name» # sometimes it stores something like: «ref: refs/heads/branch-name»
matchRef = match "^ref: (.*)$" fileContent; matchRef = match "^ref: (.*)$" fileContent;
in if isNull matchRef in if matchRef == null
then fileContent then fileContent
else readCommitFromFile (lib.head matchRef) path else readCommitFromFile (lib.head matchRef) path
# Sometimes, the file isn't there at all and has been packed away in the # Sometimes, the file isn't there at all and has been packed away in the
@ -92,7 +92,7 @@ rec {
then then
let fileContent = readFile packedRefsName; let fileContent = readFile packedRefsName;
matchRef = match (".*\n([^\n ]*) " + file + "\n.*") fileContent; matchRef = match (".*\n([^\n ]*) " + file + "\n.*") fileContent;
in if isNull matchRef in if matchRef == null
then throw ("Could not find " + file + " in " + packedRefsName) then throw ("Could not find " + file + " in " + packedRefsName)
else lib.head matchRef else lib.head matchRef
else throw ("Not a .git directory: " + path); else throw ("Not a .git directory: " + path);

View file

@ -112,7 +112,7 @@ rec {
# Function to call # Function to call
f: f:
# Argument to check for null before passing it to `f` # Argument to check for null before passing it to `f`
a: if isNull a then a else f a; a: if a == null then a else f a;
# Pull in some builtins not included elsewhere. # Pull in some builtins not included elsewhere.
inherit (builtins) inherit (builtins)

View file

@ -145,7 +145,7 @@ let
displayOptionsGraph = displayOptionsGraph =
let let
checkList = checkList =
if !(isNull testOption) then [ testOption ] if testOption != null then [ testOption ]
else testOptions; else testOptions;
checkAll = checkList == []; checkAll = checkList == [];
in in

View file

@ -31,7 +31,7 @@ let
# use latest when no version is passed # use latest when no version is passed
makeCacheConf = { version ? null }: makeCacheConf = { version ? null }:
let let
fcPackage = if builtins.isNull version fcPackage = if version == null
then "fontconfig" then "fontconfig"
else "fontconfig_${version}"; else "fontconfig_${version}";
makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; }; makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; };

View file

@ -46,7 +46,7 @@ let cfg = config.fonts.fontconfig;
# use latest when no version is passed # use latest when no version is passed
makeCacheConf = { version ? null }: makeCacheConf = { version ? null }:
let let
fcPackage = if builtins.isNull version fcPackage = if version == null
then "fontconfig" then "fontconfig"
else "fontconfig_${version}"; else "fontconfig_${version}";
makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; }; makeCache = fontconfig: pkgs.makeFontsCache { inherit fontconfig; fontDirectories = config.fonts.fonts; };

View file

@ -8,7 +8,7 @@ let
name = "sysctl option value"; name = "sysctl option value";
check = val: check = val:
let let
checkType = x: isBool x || isString x || isInt x || isNull x; checkType = x: isBool x || isString x || isInt x || x == null;
in in
checkType val || (val._type or "" == "override" && checkType val.content); checkType val || (val._type or "" == "override" && checkType val.content);
merge = loc: defs: mergeOneOption loc (filterOverrides defs); merge = loc: defs: mergeOneOption loc (filterOverrides defs);

View file

@ -198,7 +198,7 @@ let
fi fi
${ # When there is a theme configured, use it, otherwise use the background image. ${ # When there is a theme configured, use it, otherwise use the background image.
if (!isNull config.isoImage.grubTheme) then '' if config.isoImage.grubTheme != null then ''
# Sets theme. # Sets theme.
set theme=(hd0)/EFI/boot/grub-theme/theme.txt set theme=(hd0)/EFI/boot/grub-theme/theme.txt
# Load theme fonts # Load theme fonts
@ -622,7 +622,7 @@ in
{ source = "${pkgs.memtest86plus}/memtest.bin"; { source = "${pkgs.memtest86plus}/memtest.bin";
target = "/boot/memtest.bin"; target = "/boot/memtest.bin";
} }
] ++ optionals (!isNull config.isoImage.grubTheme) [ ] ++ optionals (config.isoImage.grubTheme != null) [
{ source = config.isoImage.grubTheme; { source = config.isoImage.grubTheme;
target = "/EFI/boot/grub-theme"; target = "/EFI/boot/grub-theme";
} }

View file

@ -34,7 +34,7 @@ let
bashAliases = concatStringsSep "\n" ( bashAliases = concatStringsSep "\n" (
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}") mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}")
(filterAttrs (k: v: !isNull v) cfg.shellAliases) (filterAttrs (k: v: v != null) cfg.shellAliases)
); );
in in

View file

@ -10,7 +10,7 @@ let
fishAliases = concatStringsSep "\n" ( fishAliases = concatStringsSep "\n" (
mapAttrsFlatten (k: v: "alias ${k} ${escapeShellArg v}") mapAttrsFlatten (k: v: "alias ${k} ${escapeShellArg v}")
(filterAttrs (k: v: !isNull v) cfg.shellAliases) (filterAttrs (k: v: v != null) cfg.shellAliases)
); );
in in

View file

@ -148,7 +148,7 @@ in
UseSTARTTLS=${yesNo cfg.useSTARTTLS} UseSTARTTLS=${yesNo cfg.useSTARTTLS}
#Debug=YES #Debug=YES
${optionalString (cfg.authUser != "") "AuthUser=${cfg.authUser}"} ${optionalString (cfg.authUser != "") "AuthUser=${cfg.authUser}"}
${optionalString (!isNull cfg.authPassFile) "AuthPassFile=${cfg.authPassFile}"} ${optionalString (cfg.authPassFile != null) "AuthPassFile=${cfg.authPassFile}"}
''; '';
environment.systemPackages = [pkgs.ssmtp]; environment.systemPackages = [pkgs.ssmtp];

View file

@ -12,7 +12,7 @@ let
zshAliases = concatStringsSep "\n" ( zshAliases = concatStringsSep "\n" (
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}") mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}")
(filterAttrs (k: v: !isNull v) cfg.shellAliases) (filterAttrs (k: v: v != null) cfg.shellAliases)
); );
in in

View file

@ -255,7 +255,7 @@ let
cfg = config.services.znapzend; cfg = config.services.znapzend;
onOff = b: if b then "on" else "off"; onOff = b: if b then "on" else "off";
nullOff = b: if isNull b then "off" else toString b; nullOff = b: if b == null then "off" else toString b;
stripSlashes = replaceStrings [ "/" ] [ "." ]; stripSlashes = replaceStrings [ "/" ] [ "." ];
attrsToFile = config: concatStringsSep "\n" (builtins.attrValues ( attrsToFile = config: concatStringsSep "\n" (builtins.attrValues (
@ -263,7 +263,7 @@ let
mkDestAttrs = dst: with dst; mkDestAttrs = dst: with dst;
mapAttrs' (n: v: nameValuePair "dst_${label}${n}" v) ({ mapAttrs' (n: v: nameValuePair "dst_${label}${n}" v) ({
"" = optionalString (! isNull host) "${host}:" + dataset; "" = optionalString (host != null) "${host}:" + dataset;
_plan = plan; _plan = plan;
} // optionalAttrs (presend != null) { } // optionalAttrs (presend != null) {
_precmd = presend; _precmd = presend;

View file

@ -7,9 +7,9 @@ let
cfg = top.kubelet; cfg = top.kubelet;
cniConfig = cniConfig =
if cfg.cni.config != [] && !(isNull cfg.cni.configDir) then if cfg.cni.config != [] && cfg.cni.configDir != null then
throw "Verbatim CNI-config and CNI configDir cannot both be set." throw "Verbatim CNI-config and CNI configDir cannot both be set."
else if !(isNull cfg.cni.configDir) then else if cfg.cni.configDir != null then
cfg.cni.configDir cfg.cni.configDir
else else
(pkgs.buildEnv { (pkgs.buildEnv {
@ -373,7 +373,7 @@ in
boot.kernelModules = ["br_netfilter"]; boot.kernelModules = ["br_netfilter"];
services.kubernetes.kubelet.hostname = with config.networking; services.kubernetes.kubelet.hostname = with config.networking;
mkDefault (hostName + optionalString (!isNull domain) ".${domain}"); mkDefault (hostName + optionalString (domain != null) ".${domain}");
services.kubernetes.pki.certs = with top.lib; { services.kubernetes.pki.certs = with top.lib; {
kubelet = mkCert { kubelet = mkCert {

View file

@ -285,7 +285,7 @@ in
}; };
}; };
environment.etc.${cfg.etcClusterAdminKubeconfig}.source = mkIf (!isNull cfg.etcClusterAdminKubeconfig) environment.etc.${cfg.etcClusterAdminKubeconfig}.source = mkIf (cfg.etcClusterAdminKubeconfig != null)
(top.lib.mkKubeConfig "cluster-admin" clusterAdminKubeconfig); (top.lib.mkKubeConfig "cluster-admin" clusterAdminKubeconfig);
environment.systemPackages = mkIf (top.kubelet.enable || top.proxy.enable) [ environment.systemPackages = mkIf (top.kubelet.enable || top.proxy.enable) [

View file

@ -236,7 +236,7 @@ in
}; };
assertions = [ assertions = [
{ assertion = cfg.hooksPath == hooksDir || all isNull (attrValues cfg.hooks); { assertion = cfg.hooksPath == hooksDir || all (v: v == null) (attrValues cfg.hooks);
message = '' message = ''
Options `services.buildkite-agent.hooksPath' and Options `services.buildkite-agent.hooksPath' and
`services.buildkite-agent.hooks.<name>' are mutually exclusive. `services.buildkite-agent.hooks.<name>' are mutually exclusive.

View file

@ -189,7 +189,7 @@ in {
preStart = preStart =
let replacePlugins = let replacePlugins =
if isNull cfg.plugins if cfg.plugins == null
then "" then ""
else else
let pluginCmds = lib.attrsets.mapAttrsToList let pluginCmds = lib.attrsets.mapAttrsToList

View file

@ -22,11 +22,11 @@ let
else {}) else {})
); );
cassandraConfigWithAddresses = cassandraConfig // cassandraConfigWithAddresses = cassandraConfig //
( if isNull cfg.listenAddress ( if cfg.listenAddress == null
then { listen_interface = cfg.listenInterface; } then { listen_interface = cfg.listenInterface; }
else { listen_address = cfg.listenAddress; } else { listen_address = cfg.listenAddress; }
) // ( ) // (
if isNull cfg.rpcAddress if cfg.rpcAddress == null
then { rpc_interface = cfg.rpcInterface; } then { rpc_interface = cfg.rpcInterface; }
else { rpc_address = cfg.rpcAddress; } else { rpc_address = cfg.rpcAddress; }
); );
@ -219,19 +219,13 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = assertions =
[ { assertion = [ { assertion =
((isNull cfg.listenAddress) (cfg.listenAddress == null || cfg.listenInterface == null)
|| (isNull cfg.listenInterface) && !(cfg.listenAddress == null && cfg.listenInterface == null);
) && !((isNull cfg.listenAddress)
&& (isNull cfg.listenInterface)
);
message = "You have to set either listenAddress or listenInterface"; message = "You have to set either listenAddress or listenInterface";
} }
{ assertion = { assertion =
((isNull cfg.rpcAddress) (cfg.rpcAddress == null || cfg.rpcInterface == null)
|| (isNull cfg.rpcInterface) && !(cfg.rpcAddress == null && cfg.rpcInterface == null);
) && !((isNull cfg.rpcAddress)
&& (isNull cfg.rpcInterface)
);
message = "You have to set either rpcAddress or rpcInterface"; message = "You have to set either rpcAddress or rpcInterface";
} }
]; ];
@ -276,7 +270,7 @@ in {
}; };
}; };
systemd.timers.cassandra-full-repair = systemd.timers.cassandra-full-repair =
mkIf (!isNull cfg.fullRepairInterval) { mkIf (cfg.fullRepairInterval != null) {
description = "Schedule full repairs on Cassandra"; description = "Schedule full repairs on Cassandra";
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = timerConfig =
@ -300,7 +294,7 @@ in {
}; };
}; };
systemd.timers.cassandra-incremental-repair = systemd.timers.cassandra-incremental-repair =
mkIf (!isNull cfg.incrementalRepairInterval) { mkIf (cfg.incrementalRepairInterval != null) {
description = "Schedule incremental repairs on Cassandra"; description = "Schedule incremental repairs on Cassandra";
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = timerConfig =

View file

@ -7,7 +7,7 @@ let
crdb = cfg.package; crdb = cfg.package;
escape = builtins.replaceStrings ["%"] ["%%"]; escape = builtins.replaceStrings ["%"] ["%%"];
ifNotNull = v: s: optionalString (!isNull v) s; ifNotNull = v: s: optionalString (v != null) s;
startupCommand = lib.concatStringsSep " " startupCommand = lib.concatStringsSep " "
[ # Basic startup [ # Basic startup
@ -164,7 +164,7 @@ in
config = mkIf config.services.cockroachdb.enable { config = mkIf config.services.cockroachdb.enable {
assertions = [ assertions = [
{ assertion = !cfg.insecure -> !(isNull cfg.certsDir); { assertion = !cfg.insecure -> cfg.certsDir != null;
message = "CockroachDB must have a set of SSL certificates (.certsDir), or run in Insecure Mode (.insecure = true)"; message = "CockroachDB must have a set of SSL certificates (.certsDir), or run in Insecure Mode (.insecure = true)";
} }
]; ];

View file

@ -16,7 +16,7 @@ let
super_only = ${builtins.toJSON cfg.superOnly} super_only = ${builtins.toJSON cfg.superOnly}
${optionalString (!isNull cfg.loginGroup) "login_group = ${cfg.loginGroup}"} ${optionalString (cfg.loginGroup != null) "login_group = ${cfg.loginGroup}"}
login_timeout = ${toString cfg.loginTimeout} login_timeout = ${toString cfg.loginTimeout}
@ -24,7 +24,7 @@ let
sql_root = ${cfg.sqlRoot} sql_root = ${cfg.sqlRoot}
${optionalString (!isNull cfg.tls) '' ${optionalString (cfg.tls != null) ''
tls_cert = ${cfg.tls.cert} tls_cert = ${cfg.tls.cert}
tls_key = ${cfg.tls.key} tls_key = ${cfg.tls.key}
''} ''}

View file

@ -215,8 +215,8 @@ in {
networking.firewall = mkIf cfg.openFirewall (if cfg.declarative then { networking.firewall = mkIf cfg.openFirewall (if cfg.declarative then {
allowedUDPPorts = [ serverPort ]; allowedUDPPorts = [ serverPort ];
allowedTCPPorts = [ serverPort ] allowedTCPPorts = [ serverPort ]
++ optional (! isNull queryPort) queryPort ++ optional (queryPort != null) queryPort
++ optional (! isNull rconPort) rconPort; ++ optional (rconPort != null) rconPort;
} else { } else {
allowedUDPPorts = [ defaultServerPort ]; allowedUDPPorts = [ defaultServerPort ];
allowedTCPPorts = [ defaultServerPort ]; allowedTCPPorts = [ defaultServerPort ];

View file

@ -227,7 +227,7 @@ in
''; '';
services.cron.systemCronJobs = services.cron.systemCronJobs =
let withTime = name: {timeArgs, ...}: ! (builtins.isNull timeArgs); let withTime = name: {timeArgs, ...}: timeArgs != null;
mkCron = name: {user, cmdline, timeArgs, ...}: '' mkCron = name: {user, cmdline, timeArgs, ...}: ''
${timeArgs} ${user} ${cmdline} ${timeArgs} ${user} ${cmdline}
''; '';

View file

@ -16,13 +16,13 @@ let
sendmail_path = /run/wrappers/bin/sendmail sendmail_path = /run/wrappers/bin/sendmail
'' ''
(if isNull cfg.sslServerCert then '' (if cfg.sslServerCert == null then ''
ssl = no ssl = no
disable_plaintext_auth = no disable_plaintext_auth = no
'' else '' '' else ''
ssl_cert = <${cfg.sslServerCert} ssl_cert = <${cfg.sslServerCert}
ssl_key = <${cfg.sslServerKey} ssl_key = <${cfg.sslServerKey}
${optionalString (!(isNull cfg.sslCACert)) ("ssl_ca = <" + cfg.sslCACert)} ${optionalString (cfg.sslCACert != null) ("ssl_ca = <" + cfg.sslCACert)}
ssl_dh = <${config.security.dhparams.params.dovecot2.path} ssl_dh = <${config.security.dhparams.params.dovecot2.path}
disable_plaintext_auth = yes disable_plaintext_auth = yes
'') '')
@ -298,7 +298,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
security.pam.services.dovecot2 = mkIf cfg.enablePAM {}; security.pam.services.dovecot2 = mkIf cfg.enablePAM {};
security.dhparams = mkIf (! isNull cfg.sslServerCert) { security.dhparams = mkIf (cfg.sslServerCert != null) {
enable = true; enable = true;
params.dovecot2 = {}; params.dovecot2 = {};
}; };
@ -384,14 +384,14 @@ in
{ assertion = intersectLists cfg.protocols [ "pop3" "imap" ] != []; { assertion = intersectLists cfg.protocols [ "pop3" "imap" ] != [];
message = "dovecot needs at least one of the IMAP or POP3 listeners enabled"; message = "dovecot needs at least one of the IMAP or POP3 listeners enabled";
} }
{ assertion = isNull cfg.sslServerCert == isNull cfg.sslServerKey { assertion = (cfg.sslServerCert == null) == (cfg.sslServerKey == null)
&& (!(isNull cfg.sslCACert) -> !(isNull cfg.sslServerCert || isNull cfg.sslServerKey)); && (cfg.sslCACert != null -> !(cfg.sslServerCert == null || cfg.sslServerKey == null));
message = "dovecot needs both sslServerCert and sslServerKey defined for working crypto"; message = "dovecot needs both sslServerCert and sslServerKey defined for working crypto";
} }
{ assertion = cfg.showPAMFailure -> cfg.enablePAM; { assertion = cfg.showPAMFailure -> cfg.enablePAM;
message = "dovecot is configured with showPAMFailure while enablePAM is disabled"; message = "dovecot is configured with showPAMFailure while enablePAM is disabled";
} }
{ assertion = (cfg.sieveScripts != {}) -> ((cfg.mailUser != null) && (cfg.mailGroup != null)); { assertion = cfg.sieveScripts != {} -> (cfg.mailUser != null && cfg.mailGroup != null);
message = "dovecot requires mailUser and mailGroup to be set when sieveScripts is set"; message = "dovecot requires mailUser and mailGroup to be set when sieveScripts is set";
} }
]; ];

View file

@ -143,7 +143,7 @@ in
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
PrivateTmp = true; PrivateTmp = true;
ExecStartPre = assert !isNull server.secretKeyFile; pkgs.writeScript "bepasty-server.${name}-init" '' ExecStartPre = assert server.secretKeyFile != null; pkgs.writeScript "bepasty-server.${name}-init" ''
#!/bin/sh #!/bin/sh
mkdir -p "${server.workDir}" mkdir -p "${server.workDir}"
mkdir -p "${server.dataDir}" mkdir -p "${server.dataDir}"

View file

@ -81,7 +81,7 @@ in {
systemd.services = mapAttrs' (name: instanceCfg: nameValuePair "errbot-${name}" ( systemd.services = mapAttrs' (name: instanceCfg: nameValuePair "errbot-${name}" (
let let
dataDir = if !isNull instanceCfg.dataDir then instanceCfg.dataDir else dataDir = if instanceCfg.dataDir != null then instanceCfg.dataDir else
"/var/lib/errbot/${name}"; "/var/lib/errbot/${name}";
in { in {
after = [ "network-online.target" ]; after = [ "network-online.target" ];

View file

@ -48,7 +48,7 @@ let
type = types.nullOr types.int; type = types.nullOr types.int;
default = null; default = null;
example = 365; example = 365;
apply = val: if isNull val then -1 else val; apply = val: if val == null then -1 else val;
description = mkAutoDesc '' description = mkAutoDesc ''
The expiration time of ${desc} in days or <literal>null</literal> for no The expiration time of ${desc} in days or <literal>null</literal> for no
expiration time. expiration time.
@ -82,7 +82,7 @@ let
then attrByPath newPath (notFound newPath) cfg.pki.manual then attrByPath newPath (notFound newPath) cfg.pki.manual
else findPkiDefinitions newPath val; else findPkiDefinitions newPath val;
in flatten (mapAttrsToList mkSublist attrs); in flatten (mapAttrsToList mkSublist attrs);
in all isNull (findPkiDefinitions [] manualPkiOptions); in all (x: x == null) (findPkiDefinitions [] manualPkiOptions);
orgOptions = { ... }: { orgOptions = { ... }: {
options.users = mkOption { options.users = mkOption {

View file

@ -17,7 +17,7 @@ let
defaultDir = "/var/lib/${user}"; defaultDir = "/var/lib/${user}";
home = if useCustomDir then cfg.storageDir else defaultDir; home = if useCustomDir then cfg.storageDir else defaultDir;
useCustomDir = !(builtins.isNull cfg.storageDir); useCustomDir = cfg.storageDir != null;
socket = "/run/phpfpm/${dirName}.sock"; socket = "/run/phpfpm/${dirName}.sock";

View file

@ -19,13 +19,13 @@ let
graphiteLocalSettings = pkgs.writeText "graphite_local_settings.py" ( graphiteLocalSettings = pkgs.writeText "graphite_local_settings.py" (
"STATIC_ROOT = '${staticDir}'\n" + "STATIC_ROOT = '${staticDir}'\n" +
optionalString (! isNull config.time.timeZone) "TIME_ZONE = '${config.time.timeZone}'\n" optionalString (config.time.timeZone != null) "TIME_ZONE = '${config.time.timeZone}'\n"
+ cfg.web.extraConfig + cfg.web.extraConfig
); );
graphiteApiConfig = pkgs.writeText "graphite-api.yaml" '' graphiteApiConfig = pkgs.writeText "graphite-api.yaml" ''
search_index: ${dataDir}/index search_index: ${dataDir}/index
${optionalString (!isNull config.time.timeZone) ''time_zone: ${config.time.timeZone}''} ${optionalString (config.time.timeZone != null) ''time_zone: ${config.time.timeZone}''}
${optionalString (cfg.api.finders != []) ''finders:''} ${optionalString (cfg.api.finders != []) ''finders:''}
${concatMapStringsSep "\n" (f: " - " + f.moduleName) cfg.api.finders} ${concatMapStringsSep "\n" (f: " - " + f.moduleName) cfg.api.finders}
${optionalString (cfg.api.functions != []) ''functions:''} ${optionalString (cfg.api.functions != []) ''functions:''}

View file

@ -92,7 +92,7 @@ in {
Needed when running with Kubernetes as backend as this cannot be auto-detected"; Needed when running with Kubernetes as backend as this cannot be auto-detected";
''; '';
type = types.nullOr types.str; type = types.nullOr types.str;
default = with config.networking; (hostName + optionalString (!isNull domain) ".${domain}"); default = with config.networking; (hostName + optionalString (domain != null) ".${domain}");
example = "node1.example.com"; example = "node1.example.com";
}; };

View file

@ -12,9 +12,9 @@ let
boolOpt = k: v: k + " = " + boolToString v; boolOpt = k: v: k + " = " + boolToString v;
intOpt = k: v: k + " = " + toString v; intOpt = k: v: k + " = " + toString v;
lstOpt = k: xs: k + " = " + concatStringsSep "," xs; lstOpt = k: xs: k + " = " + concatStringsSep "," xs;
optionalNullString = o: s: optional (! isNull s) (strOpt o s); optionalNullString = o: s: optional (s != null) (strOpt o s);
optionalNullBool = o: b: optional (! isNull b) (boolOpt o b); optionalNullBool = o: b: optional (b != null) (boolOpt o b);
optionalNullInt = o: i: optional (! isNull i) (intOpt o i); optionalNullInt = o: i: optional (i != null) (intOpt o i);
optionalEmptyList = o: l: optional ([] != l) (lstOpt o l); optionalEmptyList = o: l: optional ([] != l) (lstOpt o l);
mkEnableTrueOption = name: mkEnableOption name // { default = true; }; mkEnableTrueOption = name: mkEnableOption name // { default = true; };
@ -225,7 +225,7 @@ let
i2pdSh = pkgs.writeScriptBin "i2pd" '' i2pdSh = pkgs.writeScriptBin "i2pd" ''
#!/bin/sh #!/bin/sh
exec ${pkgs.i2pd}/bin/i2pd \ exec ${pkgs.i2pd}/bin/i2pd \
${if isNull cfg.address then "" else "--host="+cfg.address} \ ${if cfg.address == null then "" else "--host="+cfg.address} \
--service \ --service \
--conf=${i2pdConf} \ --conf=${i2pdConf} \
--tunconf=${tunnelConf} --tunconf=${tunnelConf}

View file

@ -56,7 +56,7 @@ rec {
}; };
documentDefault = description : strongswanDefault : documentDefault = description : strongswanDefault :
if isNull strongswanDefault if strongswanDefault == null
then description then description
else description + '' else description + ''
</para><para> </para><para>

View file

@ -45,10 +45,10 @@ rec {
filterEmptySets ( filterEmptySets (
(mapParamsRecursive (path: name: param: (mapParamsRecursive (path: name: param:
let value = attrByPath path null cfg; let value = attrByPath path null cfg;
in optionalAttrs (!isNull value) (param.render name value) in optionalAttrs (value != null) (param.render name value)
) ps)); ) ps));
filterEmptySets = set : filterAttrs (n: v: !(isNull v)) (mapAttrs (name: value: filterEmptySets = set : filterAttrs (n: v: (v != null)) (mapAttrs (name: value:
if isAttrs value if isAttrs value
then let value' = filterEmptySets value; then let value' = filterEmptySets value;
in if value' == {} in if value' == {}

View file

@ -129,7 +129,7 @@ in {
This defaults to the singleton list [ca] when the <option>ca</option> option is defined. This defaults to the singleton list [ca] when the <option>ca</option> option is defined.
''; '';
default = if isNull cfg.elasticsearch.ca then [] else [ca]; default = if cfg.elasticsearch.ca == null then [] else [ca];
type = types.listOf types.path; type = types.listOf types.path;
}; };

View file

@ -58,11 +58,11 @@ let
httponly = cookie.httpOnly; httponly = cookie.httpOnly;
}; };
set-xauthrequest = setXauthrequest; set-xauthrequest = setXauthrequest;
} // lib.optionalAttrs (!isNull cfg.email.addresses) { } // lib.optionalAttrs (cfg.email.addresses != null) {
authenticated-emails-file = authenticatedEmailsFile; authenticated-emails-file = authenticatedEmailsFile;
} // lib.optionalAttrs (cfg.passBasicAuth) { } // lib.optionalAttrs (cfg.passBasicAuth) {
basic-auth-password = cfg.basicAuthPassword; basic-auth-password = cfg.basicAuthPassword;
} // lib.optionalAttrs (!isNull cfg.htpasswd.file) { } // lib.optionalAttrs (cfg.htpasswd.file != null) {
display-htpasswd-file = cfg.htpasswd.displayForm; display-htpasswd-file = cfg.htpasswd.displayForm;
} // lib.optionalAttrs tls.enable { } // lib.optionalAttrs tls.enable {
tls-cert = tls.certificate; tls-cert = tls.certificate;
@ -71,7 +71,7 @@ let
} // (getProviderOptions cfg cfg.provider) // cfg.extraConfig; } // (getProviderOptions cfg cfg.provider) // cfg.extraConfig;
mapConfig = key: attr: mapConfig = key: attr:
if (!isNull attr && attr != []) then ( if attr != null && attr != [] then (
if isDerivation attr then mapConfig key (toString attr) else if isDerivation attr then mapConfig key (toString attr) else
if (builtins.typeOf attr) == "set" then concatStringsSep " " if (builtins.typeOf attr) == "set" then concatStringsSep " "
(mapAttrsToList (name: value: mapConfig (key + "-" + name) value) attr) else (mapAttrsToList (name: value: mapConfig (key + "-" + name) value) attr) else
@ -538,7 +538,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.oauth2_proxy = mkIf (!isNull cfg.keyFile) { services.oauth2_proxy = mkIf (cfg.keyFile != null) {
clientID = mkDefault null; clientID = mkDefault null;
clientSecret = mkDefault null; clientSecret = mkDefault null;
cookie.secret = mkDefault null; cookie.secret = mkDefault null;

View file

@ -85,7 +85,7 @@ in
DynamicUser = true; DynamicUser = true;
RuntimeDirectory = "miniflux"; RuntimeDirectory = "miniflux";
RuntimeDirectoryMode = "0700"; RuntimeDirectoryMode = "0700";
EnvironmentFile = if isNull cfg.adminCredentialsFile EnvironmentFile = if cfg.adminCredentialsFile == null
then defaultCredentials then defaultCredentials
else cfg.adminCredentialsFile; else cfg.adminCredentialsFile;
}; };

View file

@ -184,7 +184,7 @@ in
phpOptions = '' phpOptions = ''
date.timezone = "CET" date.timezone = "CET"
${optionalString (!isNull cfg.email.server) '' ${optionalString (cfg.email.server != null) ''
SMTP = ${cfg.email.server} SMTP = ${cfg.email.server}
smtp_port = ${toString cfg.email.port} smtp_port = ${toString cfg.email.port}
auth_username = ${cfg.email.login} auth_username = ${cfg.email.login}
@ -282,7 +282,7 @@ in
sed -i "s@^php@${config.services.phpfpm.phpPackage}/bin/php@" "${runDir}/server/php/shell/"*.sh sed -i "s@^php@${config.services.phpfpm.phpPackage}/bin/php@" "${runDir}/server/php/shell/"*.sh
${if (isNull cfg.database.host) then '' ${if (cfg.database.host == null) then ''
sed -i "s/^.*'R_DB_HOST'.*$/define('R_DB_HOST', 'localhost');/g" "${runDir}/server/php/config.inc.php" sed -i "s/^.*'R_DB_HOST'.*$/define('R_DB_HOST', 'localhost');/g" "${runDir}/server/php/config.inc.php"
sed -i "s/^.*'R_DB_PASSWORD'.*$/define('R_DB_PASSWORD', 'restya');/g" "${runDir}/server/php/config.inc.php" sed -i "s/^.*'R_DB_PASSWORD'.*$/define('R_DB_PASSWORD', 'restya');/g" "${runDir}/server/php/config.inc.php"
'' else '' '' else ''
@ -311,7 +311,7 @@ in
chown -R "${cfg.user}"."${cfg.group}" "${cfg.dataDir}/media" chown -R "${cfg.user}"."${cfg.group}" "${cfg.dataDir}/media"
chown -R "${cfg.user}"."${cfg.group}" "${cfg.dataDir}/client/img" chown -R "${cfg.user}"."${cfg.group}" "${cfg.dataDir}/client/img"
${optionalString (isNull cfg.database.host) '' ${optionalString (cfg.database.host == null) ''
if ! [ -e "${cfg.dataDir}/.db-initialized" ]; then if ! [ -e "${cfg.dataDir}/.db-initialized" ]; then
${pkgs.sudo}/bin/sudo -u ${config.services.postgresql.superUser} \ ${pkgs.sudo}/bin/sudo -u ${config.services.postgresql.superUser} \
${config.services.postgresql.package}/bin/psql -U ${config.services.postgresql.superUser} \ ${config.services.postgresql.package}/bin/psql -U ${config.services.postgresql.superUser} \
@ -367,14 +367,14 @@ in
}; };
users.groups.restya-board = {}; users.groups.restya-board = {};
services.postgresql.enable = mkIf (isNull cfg.database.host) true; services.postgresql.enable = mkIf (cfg.database.host == null) true;
services.postgresql.identMap = optionalString (isNull cfg.database.host) services.postgresql.identMap = optionalString (cfg.database.host == null)
'' ''
restya-board-users restya-board restya_board restya-board-users restya-board restya_board
''; '';
services.postgresql.authentication = optionalString (isNull cfg.database.host) services.postgresql.authentication = optionalString (cfg.database.host == null)
'' ''
local restya_board all ident map=restya-board-users local restya_board all ident map=restya-board-users
''; '';

View file

@ -690,7 +690,7 @@ in
; Don't advertise PHP ; Don't advertise PHP
expose_php = off expose_php = off
'' + optionalString (!isNull config.time.timeZone) '' '' + optionalString (config.time.timeZone != null) ''
; Apparently PHP doesn't use $TZ. ; Apparently PHP doesn't use $TZ.
date.timezone = "${config.time.timeZone}" date.timezone = "${config.time.timeZone}"

View file

@ -177,13 +177,13 @@ let
"--rm" "--rm"
"--name=%n" "--name=%n"
"--log-driver=${container.log-driver}" "--log-driver=${container.log-driver}"
] ++ optional (! isNull container.entrypoint) ] ++ optional (container.entrypoint != null)
"--entrypoint=${escapeShellArg container.entrypoint}" "--entrypoint=${escapeShellArg container.entrypoint}"
++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment) ++ (mapAttrsToList (k: v: "-e ${escapeShellArg k}=${escapeShellArg v}") container.environment)
++ map (p: "-p ${escapeShellArg p}") container.ports ++ map (p: "-p ${escapeShellArg p}") container.ports
++ optional (! isNull container.user) "-u ${escapeShellArg container.user}" ++ optional (container.user != null) "-u ${escapeShellArg container.user}"
++ map (v: "-v ${escapeShellArg v}") container.volumes ++ map (v: "-v ${escapeShellArg v}") container.volumes
++ optional (! isNull container.workdir) "-w ${escapeShellArg container.workdir}" ++ optional (container.workdir != null) "-w ${escapeShellArg container.workdir}"
++ map escapeShellArg container.extraDockerOptions ++ map escapeShellArg container.extraDockerOptions
++ [container.image] ++ [container.image]
++ map escapeShellArg container.cmd ++ map escapeShellArg container.cmd

View file

@ -51,7 +51,7 @@ in
popd popd
''; '';
format = "raw"; format = "raw";
configFile = if isNull cfg.configFile then defaultConfigFile else cfg.configFile; configFile = if cfg.configFile == null then defaultConfigFile else cfg.configFile;
inherit (cfg) diskSize; inherit (cfg) diskSize;
inherit config lib pkgs; inherit config lib pkgs;
}; };

View file

@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
src = src =
if stdenv.hostPlatform.system == "x86_64-linux" then if stdenv.hostPlatform.system == "x86_64-linux" then
if builtins.isNull releasePath then if releasePath == null then
fetchurl { fetchurl {
url = "https://files.renoise.com/demo/Renoise_${urlVersion version}_Demo_x86_64.tar.bz2"; url = "https://files.renoise.com/demo/Renoise_${urlVersion version}_Demo_x86_64.tar.bz2";
sha256 = "0pan68fr22xbj7a930y29527vpry3f07q3i9ya4fp6g7aawffsga"; sha256 = "0pan68fr22xbj7a930y29527vpry3f07q3i9ya4fp6g7aawffsga";
@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
else else
releasePath releasePath
else if stdenv.hostPlatform.system == "i686-linux" then else if stdenv.hostPlatform.system == "i686-linux" then
if builtins.isNull releasePath then if releasePath == null then
fetchurl { fetchurl {
url = "http://files.renoise.com/demo/Renoise_${urlVersion version}_Demo_x86.tar.bz2"; url = "http://files.renoise.com/demo/Renoise_${urlVersion version}_Demo_x86.tar.bz2";
sha256 = "1lccjj4k8hpqqxxham5v01v2rdwmx3c5kgy1p9lqvzqma88k4769"; sha256 = "1lccjj4k8hpqqxxham5v01v2rdwmx3c5kgy1p9lqvzqma88k4769";

View file

@ -10,7 +10,7 @@ let
alternativeConfig = builtins.toFile "lumail2.lua" alternativeConfig = builtins.toFile "lumail2.lua"
(builtins.readFile alternativeGlobalConfigFilePath); (builtins.readFile alternativeGlobalConfigFilePath);
globalConfig = if isNull alternativeGlobalConfigFilePath then '' globalConfig = if alternativeGlobalConfigFilePath == null then ''
mkdir -p $out/etc/lumail2 mkdir -p $out/etc/lumail2
cp global.config.lua $out/etc/lumail2.lua cp global.config.lua $out/etc/lumail2.lua
for n in ./lib/*.lua; do for n in ./lib/*.lua; do

View file

@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
version = "128"; version = "128";
src = src =
if builtins.isNull releasePath then if releasePath == null then
throw '' throw ''
This nix expression requires that the cplex installer is already This nix expression requires that the cplex installer is already
downloaded to your machine. Get it from IBM: downloaded to your machine. Get it from IBM:

View file

@ -59,7 +59,7 @@ let
# return the names of all dependencies in the transitive closure # return the names of all dependencies in the transitive closure
transitiveClosure = dep: transitiveClosure = dep:
if isNull dep then if dep == null then
# propagatedBuildInputs might contain null # propagatedBuildInputs might contain null
# (although that might be considered a programming error in the derivation) # (although that might be considered a programming error in the derivation)
[] []

View file

@ -59,7 +59,7 @@ let self = rec {
extraRuntimeDependencies = [ ]; extraRuntimeDependencies = [ ];
installPhase = '' installPhase = ''
${if isNull sourceDir then "" else "cd $src/$sourceDir"} ${if sourceDir == null then "" else "cd $src/$sourceDir"}
d=$out${pluginDir}/${namespace} d=$out${pluginDir}/${namespace}
mkdir -p $d mkdir -p $d
sauce="." sauce="."

View file

@ -31,7 +31,7 @@ in
import ./generic.nix { inherit lib stdenv emacs texinfo; } ({ import ./generic.nix { inherit lib stdenv emacs texinfo; } ({
ename = ename =
if isNull(ename) if ename == null
then pname then pname
else ename; else ename;

View file

@ -120,7 +120,7 @@ let
haskellSrc2nix = { name, src, sha256 ? null, extraCabal2nixOptions ? "" }: haskellSrc2nix = { name, src, sha256 ? null, extraCabal2nixOptions ? "" }:
let let
sha256Arg = if isNull sha256 then "--sha256=" else ''--sha256="${sha256}"''; sha256Arg = if sha256 == null then "--sha256=" else ''--sha256="${sha256}"'';
in pkgs.buildPackages.stdenv.mkDerivation { in pkgs.buildPackages.stdenv.mkDerivation {
name = "cabal2nix-${name}"; name = "cabal2nix-${name}";
nativeBuildInputs = [ pkgs.buildPackages.cabal2nix ]; nativeBuildInputs = [ pkgs.buildPackages.cabal2nix ];

View file

@ -7,7 +7,7 @@
with import ./util.nix { inherit lib; }; with import ./util.nix { inherit lib; };
stdenv.mkDerivation ((lib.optionalAttrs (! isNull buildScript) { stdenv.mkDerivation ((lib.optionalAttrs (buildScript != null) {
builder = buildScript; builder = buildScript;
}) // rec { }) // rec {
inherit name src configureFlags; inherit name src configureFlags;

View file

@ -128,7 +128,7 @@ rec {
with the following function: with the following function:
isFree = license: with builtins; isFree = license: with builtins;
if isNull license then true if license == null then true
else if isList license then lib.all isFree license else if isList license then lib.all isFree license
else license != "non-free" && license != "unfree"; else license != "non-free" && license != "unfree";

View file

@ -81,7 +81,7 @@ in rec {
bintools = { name = "${name}-binutils"; outPath = bootstrapTools; }; bintools = { name = "${name}-binutils"; outPath = bootstrapTools; };
}; };
cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper { cc = if last == null then "/dev/null" else import ../../build-support/cc-wrapper {
inherit shell; inherit shell;
inherit (last) stdenvNoCC; inherit (last) stdenvNoCC;

View file

@ -96,7 +96,7 @@ let
inherit system; inherit system;
}; };
cc = if isNull prevStage.gcc-unwrapped cc = if prevStage.gcc-unwrapped == null
then null then null
else lib.makeOverridable (import ../../build-support/cc-wrapper) { else lib.makeOverridable (import ../../build-support/cc-wrapper) {
name = "${name}-gcc-wrapper"; name = "${name}-gcc-wrapper";

View file

@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
buildInputs = [ openmp ]; buildInputs = [ openmp ];
buildFlags = [ (optional (isNull openmp) "NO_OPENMP=1") ]; buildFlags = [ (optional (openmp == null) "NO_OPENMP=1") ];
installFlags = [ "PREFIX=$(out)" ]; installFlags = [ "PREFIX=$(out)" ];
meta = { meta = {

View file

@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
buildInputs = let buildInputs = let
gflags' = google-gflags.overrideAttrs (old: { gflags' = google-gflags.overrideAttrs (old: {
cmakeFlags = stdenv.lib.filter (f: isNull (builtins.match ".*STATIC.*" f)) old.cmakeFlags; cmakeFlags = stdenv.lib.filter (f: (builtins.match ".*STATIC.*" f) == null) old.cmakeFlags;
}); });
# use older `lvm2` source for osquery, the 2.03 sourcetree # use older `lvm2` source for osquery, the 2.03 sourcetree