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

svn path=/nixpkgs/trunk/; revision=21353
This commit is contained in:
Marc Weber 2010-04-27 18:44:23 +00:00
parent d2b3e548a1
commit ae8d4501b6

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