summary refs log tree commit diff
path: root/lib/systems/parse.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-03-19 00:16:25 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-03-19 12:02:49 -0400
commitbbfa2f97014de8aa928485a07b722d792b09238f (patch)
tree281c076a5bf5477346e05337cdb35eba3bef2497 /lib/systems/parse.nix
parent2fa2197a96fec6a15623bfab96b27d2b1fbe8949 (diff)
downloadnixpkgs-bbfa2f97014de8aa928485a07b722d792b09238f.tar
nixpkgs-bbfa2f97014de8aa928485a07b722d792b09238f.tar.gz
nixpkgs-bbfa2f97014de8aa928485a07b722d792b09238f.tar.bz2
nixpkgs-bbfa2f97014de8aa928485a07b722d792b09238f.tar.lz
nixpkgs-bbfa2f97014de8aa928485a07b722d792b09238f.tar.xz
nixpkgs-bbfa2f97014de8aa928485a07b722d792b09238f.tar.zst
nixpkgs-bbfa2f97014de8aa928485a07b722d792b09238f.zip
lib: Split Darwin into macOS and iOS
I noticed LLVM accepts `ios` as its own OS in platform triples; a
recent change as far as I know. I see it also accepts `macos*` for macOS
(formerly OS X). If it's now customary to distinguish iOS like so
(rather than guessing from the aarch, lets add both so our OSes are
still disjoint, and make Darwin a family instead.

But changing the config everywhere would probably be a mass rebuild, and
I'm not sure how well other software supports OSes besides "darwin", so
I'm keeping that the default name for macOS for now.
Diffstat (limited to 'lib/systems/parse.nix')
-rw-r--r--lib/systems/parse.nix18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix
index 03d052f5f19..641a7f5d758 100644
--- a/lib/systems/parse.nix
+++ b/lib/systems/parse.nix
@@ -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;
   };
 
@@ -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