diff options
author | Marc Weber <marco-oweber@gmx.de> | 2010-04-27 18:44:23 +0000 |
---|---|---|
committer | Marc Weber <marco-oweber@gmx.de> | 2010-04-27 18:44:23 +0000 |
commit | ae8d4501b65ad6be7d83b3da60672c39e1b8ffcb (patch) | |
tree | 955b23a249313b60a625cd3b2e1a3052c1f92503 | |
parent | d2b3e548a126b9202f7f6ce68bfbaa91ad910dda (diff) | |
download | nixpkgs-ae8d4501b65ad6be7d83b3da60672c39e1b8ffcb.tar nixpkgs-ae8d4501b65ad6be7d83b3da60672c39e1b8ffcb.tar.gz nixpkgs-ae8d4501b65ad6be7d83b3da60672c39e1b8ffcb.tar.bz2 nixpkgs-ae8d4501b65ad6be7d83b3da60672c39e1b8ffcb.tar.lz nixpkgs-ae8d4501b65ad6be7d83b3da60672c39e1b8ffcb.tar.xz nixpkgs-ae8d4501b65ad6be7d83b3da60672c39e1b8ffcb.tar.zst nixpkgs-ae8d4501b65ad6be7d83b3da60672c39e1b8ffcb.zip |
adding maybeEnv. This will replace from-env.nix in nixos and will be reused in copySystemConfiguration
svn path=/nixpkgs/trunk/; revision=21353
-rw-r--r-- | pkgs/lib/misc.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix index 2cfd15735a7..0a8c61d6c85 100644 --- a/pkgs/lib/misc.nix +++ b/pkgs/lib/misc.nix @@ -9,6 +9,11 @@ with import ./strings.nix; rec { + # returns default if env var is not set + maybeEnv = name: default: + let value = builtins.getEnv name; in + if value == "" then default else value; + defaultMergeArg = x : y: if builtins.isAttrs y then y else |