summary refs log tree commit diff
path: root/lib/systems/parse.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-04-25 15:57:19 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-04-30 23:06:59 -0400
commit57723e947a5a935e71e7b0592a88f259e4969336 (patch)
treeeca8d17878162b3e587b7e9cd0cbf69760ad6be7 /lib/systems/parse.nix
parentb9acfb4ecfbbdac123fed170f5b2806fe4e846d0 (diff)
parent948c8dc474954fce1e340308062a3af0a66610ac (diff)
downloadnixlib-57723e947a5a935e71e7b0592a88f259e4969336.tar
nixlib-57723e947a5a935e71e7b0592a88f259e4969336.tar.gz
nixlib-57723e947a5a935e71e7b0592a88f259e4969336.tar.bz2
nixlib-57723e947a5a935e71e7b0592a88f259e4969336.tar.lz
nixlib-57723e947a5a935e71e7b0592a88f259e4969336.tar.xz
nixlib-57723e947a5a935e71e7b0592a88f259e4969336.tar.zst
nixlib-57723e947a5a935e71e7b0592a88f259e4969336.zip
Merge remote-tracking branch 'upstream/master' into aarch32
Diffstat (limited to 'lib/systems/parse.nix')
-rw-r--r--lib/systems/parse.nix26
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix
index 8a6c951d5e5e..018fd172e687 100644
--- a/lib/systems/parse.nix
+++ b/lib/systems/parse.nix
@@ -34,7 +34,7 @@ rec {
 
   ################################################################################
 
-  types.openSignifiantByte = mkOptionType {
+  types.openSignificantByte = mkOptionType {
     name = "significant-byte";
     description = "Endianness";
     merge = mergeOneOption;
@@ -42,7 +42,7 @@ rec {
 
   types.significantByte = enum (attrValues significantBytes);
 
-  significantBytes = setTypes types.openSignifiantByte {
+  significantBytes = setTypes types.openSignificantByte {
     bigEndian = {};
     littleEndian = {};
   };
@@ -134,6 +134,7 @@ rec {
 
   kernelFamilies = setTypes types.openKernelFamily {
     bsd = {};
+    darwin = {};
   };
 
   ################################################################################
@@ -149,7 +150,10 @@ rec {
   types.kernel = enum (attrValues kernels);
 
   kernels = with execFormats; with kernelFamilies; setTypes types.openKernel {
-    darwin  = { execFormat = macho;   families = { }; };
+    # TODO(@Ericson2314): Don't want to mass-rebuild yet to keeping 'darwin' as
+    # the nnormalized name for macOS.
+    macos   = { execFormat = macho;   families = { inherit darwin; }; name = "darwin"; };
+    ios     = { execFormat = macho;   families = { inherit darwin; }; };
     freebsd = { execFormat = elf;     families = { inherit bsd; }; };
     hurd    = { execFormat = elf;     families = { }; };
     linux   = { execFormat = elf;     families = { }; };
@@ -159,9 +163,13 @@ rec {
     solaris = { execFormat = elf;     families = { }; };
     windows = { execFormat = pe;      families = { }; };
   } // { # 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.darwin;
-    darwin14 = kernels.darwin;
+    darwin10 = kernels.macos;
+    darwin14 = kernels.macos;
+    watchos = kernels.ios;
+    tvos = kernels.ios;
     win32 = kernels.windows;
   };
 
@@ -193,7 +201,7 @@ rec {
 
   ################################################################################
 
-  types.system = mkOptionType {
+  types.parsedPlatform = mkOptionType {
     name = "system";
     description = "fully parsed representation of llvm- or nix-style platform tuple";
     merge = mergeOneOption;
@@ -207,7 +215,7 @@ rec {
   isSystem = isType "system";
 
   mkSystem = components:
-    assert types.system.check components;
+    assert types.parsedPlatform.check components;
     setType "system" components;
 
   mkSkeletonFromList = l: {
@@ -263,8 +271,8 @@ rec {
   mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s));
 
   doubleFromSystem = { cpu, vendor, kernel, abi, ... }:
-    if abi == abis.cygnus
-    then "${cpu.name}-cygwin"
+    /**/ if abi == abis.cygnus       then "${cpu.name}-cygwin"
+    else if kernel.families ? darwin then "${cpu.name}-darwin"
     else "${cpu.name}-${kernel.name}";
 
   tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let