summary refs log tree commit diff
path: root/pkgs/lib/misc.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/lib/misc.nix')
-rw-r--r--pkgs/lib/misc.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix
index 32b30ee2fbf..f3eb7e8bf8f 100644
--- a/pkgs/lib/misc.nix
+++ b/pkgs/lib/misc.nix
@@ -95,6 +95,11 @@ rec {
 
   
   # shortcut for attrByPath ["name"] default attrs
+  maybeAttrNullable = name: default: attrs:
+    if attrs == null then default else 
+    if (__hasAttr name attrs) then (__getAttr name attrs) else default;
+
+  # shortcut for attrByPath ["name"] default attrs
   maybeAttr = name: default: attrs:
     if (__hasAttr name attrs) then (__getAttr name attrs) else default;
 
@@ -204,8 +209,8 @@ rec {
     innerClosePropagation 
       (ready ++ [(head list)])
       ((tail list) 
-         ++ (maybeAttr "propagatedBuildInputs" [] (head list))
-	 ++ (maybeAttr "propagatedBuildNativeInputs" [] (head list)));
+         ++ (maybeAttrNullable "propagatedBuildInputs" [] (head list))
+	 ++ (maybeAttrNullable "propagatedBuildNativeInputs" [] (head list)));
 
   closePropagation = list: (uniqList {inputList = (innerClosePropagation [] list);});