lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

Introduce `mapNullable` into lib and use it in a few places

Also simply some configure flag logic my grep also alerted me too.

+18 -14
+3
lib/trivial.nix
··· 108 108 # Flip the order of the arguments of a binary function. 109 109 flip = f: a: b: f b a; 110 110 111 + # Apply function if argument is non-null 112 + mapNullable = f: a: if isNull a then a else f a; 113 + 111 114 # Pull in some builtins not included elsewhere. 112 115 inherit (builtins) 113 116 pathExists readFile isBool isFunction
+1 -1
nixos/modules/services/monitoring/graphite.nix
··· 4 4 5 5 let 6 6 cfg = config.services.graphite; 7 - writeTextOrNull = f: t: if t == null then null else pkgs.writeTextDir f t; 7 + writeTextOrNull = f: t: mapNullable (pkgs.writeTextDir f) t; 8 8 9 9 dataDir = cfg.dataDir; 10 10
+1 -1
nixos/modules/services/monitoring/prometheus/default.nix
··· 134 134 }; 135 135 }); 136 136 default = null; 137 - apply = x: if x == null then null else _filter x; 137 + apply = x: mapNullable _filter x; 138 138 description = '' 139 139 Optional http login credentials for metrics scraping. 140 140 '';
+4 -3
pkgs/development/libraries/wiredtiger/default.nix
··· 7 7 8 8 with stdenv.lib; 9 9 let 10 - mkFlag = trueStr: falseStr: cond: name: val: 11 - if cond == null then null else 12 - "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 10 + mkFlag = trueStr: falseStr: cond: name: val: "--" 11 + + (if cond then trueStr else falseStr) 12 + + name 13 + + optionalString (val != null && cond != false) "=${val}"; 13 14 mkEnable = mkFlag "enable-" "disable-"; 14 15 mkWith = mkFlag "with-" "without-"; 15 16 mkOther = mkFlag "" "" true;
+1 -1
pkgs/os-specific/linux/nvidia-x11/generic.nix
··· 73 73 withGtk2 = preferGtk2; 74 74 withGtk3 = !preferGtk2; 75 75 }; 76 - persistenced = if persistencedSha256 == null then null else callPackage (import ./persistenced.nix self persistencedSha256) { }; 76 + persistenced = mapNullable (hash: callPackage (import ./persistenced.nix self hash) { }) persistencedSha256; 77 77 }; 78 78 79 79 meta = with stdenv.lib; {
+4 -3
pkgs/servers/shishi/default.nix
··· 6 6 }: 7 7 8 8 let 9 - mkFlag = trueStr: falseStr: cond: name: val: 10 - if cond == null then null else 11 - "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 9 + mkFlag = trueStr: falseStr: cond: name: val: "--" 10 + + (if cond then trueStr else falseStr) 11 + + name 12 + + stdenv.lib.optionalString (val != null && cond != false) "=${val}"; 12 13 mkEnable = mkFlag "enable-" "disable-"; 13 14 mkWith = mkFlag "with-" "without-"; 14 15 mkOther = mkFlag "" "" true;
+4 -5
pkgs/tools/filesystems/ceph/generic.nix
··· 31 31 with stdenv.lib; 32 32 let 33 33 inherit (python2Packages) python; 34 - mkFlag = trueStr: falseStr: cond: name: val: 35 - if cond == null then null else 36 - "--${if cond != false then trueStr else falseStr}${name}" 37 - + "${if val != null && cond != false then "=${val}" else ""}"; 38 - 34 + mkFlag = trueStr: falseStr: cond: name: val: "--" 35 + + (if cond then trueStr else falseStr) 36 + + name 37 + + optionalString (val != null && cond != false) "=${val}"; 39 38 mkEnable = mkFlag "enable-" "disable-"; 40 39 mkWith = mkFlag "with-" "without-"; 41 40 mkOther = mkFlag "" "" true;