summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/systems/parse.nix10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix
index 47841a9eba5c..b07396a9dfd7 100644
--- a/lib/systems/parse.nix
+++ b/lib/systems/parse.nix
@@ -18,6 +18,7 @@
 with lib.lists;
 with lib.types;
 with lib.attrsets;
+with lib.strings;
 with (import ./inspect.nix { inherit lib; }).predicates;
 
 let
@@ -179,9 +180,6 @@ rec {
   } // { # aliases
     # 'darwin' is the kernel for all of them. We choose macOS by default.
     darwin = kernels.macos;
-    # TODO(@Ericson2314): Handle these Darwin version suffixes more generally.
-    darwin10 = kernels.macos;
-    darwin14 = kernels.macos;
     watchos = kernels.ios;
     tvos = kernels.ios;
     win32 = kernels.windows;
@@ -269,6 +267,8 @@ rec {
         then { cpu = elemAt l 0;                      kernel = elemAt l 1; abi = elemAt l 2; }
       else if (elemAt l 2 == "mingw32") # autotools breaks on -gnu for window
         then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "windows";  abi = "gnu"; }
+      else if hasPrefix "netbsd" (elemAt l 2)
+        then { cpu = elemAt l 0; vendor = elemAt l 1;    kernel = elemAt l 2;                }
       else throw "Target specification with 3 components is ambiguous";
     "4" =    { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; abi = elemAt l 3; };
   }.${toString (length l)}
@@ -295,7 +295,9 @@ rec {
         else if isDarwin  parsed then vendors.apple
         else if isWindows parsed then vendors.pc
         else                     vendors.unknown;
-      kernel = getKernel args.kernel;
+      kernel = if hasPrefix "darwin" args.kernel      then getKernel "darwin"
+               else if hasPrefix "netbsd" args.kernel then getKernel "netbsd"
+               else                                   getKernel args.kernel;
       abi =
         /**/ if args ? abi       then getAbi args.abi
         else if isLinux   parsed then