adding maybeEnv. This will replace from-env.nix in nixos and will be reused in copySystemConfiguration

From trunk@21353

svn path=/nixpkgs/branches/mass-update-01/; revision=21389
This commit is contained in:
Yury G. Kudryashov
2010-04-27 20:56:47 +00:00
parent 9f2762c7e2
commit f7bd79dfc9

View File

@@ -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