summary refs log tree commit diff
path: root/lib/systems
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-04-26 22:17:48 +0200
committersternenseemann <sternenseemann@systemli.org>2022-05-23 21:25:04 +0200
commitacb063701a6a209a514bbdefacc9bce22332ef60 (patch)
tree37cfe400a5a5ec8f7792f52060363f7aa5cff213 /lib/systems
parentfe836f35644a152c5a38d09e162694fec9755b6b (diff)
downloadnixpkgs-acb063701a6a209a514bbdefacc9bce22332ef60.tar
nixpkgs-acb063701a6a209a514bbdefacc9bce22332ef60.tar.gz
nixpkgs-acb063701a6a209a514bbdefacc9bce22332ef60.tar.bz2
nixpkgs-acb063701a6a209a514bbdefacc9bce22332ef60.tar.lz
nixpkgs-acb063701a6a209a514bbdefacc9bce22332ef60.tar.xz
nixpkgs-acb063701a6a209a514bbdefacc9bce22332ef60.tar.zst
nixpkgs-acb063701a6a209a514bbdefacc9bce22332ef60.zip
lib.systems.elaborate: expose canExecute predicate over isCompatible
canExecute is like isCompatible, but also checks that the Kernels are
_equal_, i.e. that both platforms use the same syscall interface. This
is crucial in order to actually be able to execute binaries for the
other platform.

isCompatible is dropped, since it has changed semantically and there's
no use case left in nixpkgs.
Diffstat (limited to 'lib/systems')
-rw-r--r--lib/systems/default.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index e02890b1138..74f84914faa 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -34,8 +34,10 @@ rec {
       # Either of these can be losslessly-extracted from `parsed` iff parsing succeeds.
       system = parse.doubleFromSystem final.parsed;
       config = parse.tripleFromSystem final.parsed;
-      # Determine whether we are compatible with the provided CPU
-      isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu;
+      # Determine whether we can execute binaries built for the provided platform.
+      canExecute = platform:
+        parse.isCompatible final.parsed.cpu platform.parsed.cpu
+        && final.parsed.kernel == platform.parsed.kernel;
       # Derived meta-data
       libc =
         /**/ if final.isDarwin              then "libSystem"