about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2023-10-25 16:47:31 -0400
committerGitHub <noreply@github.com>2023-10-25 16:47:31 -0400
commit791c147cc27444b6c98050e4120f0174fdc4498d (patch)
tree4995566b99d995c37c3183ceb689e8966d1a8193 /lib
parent2bb79db3e2cc8c4ce836ca7af94e73dd69e54a3a (diff)
parent20b62456f0c85b206e59db5f16a7cd0016fa8262 (diff)
downloadnixlib-791c147cc27444b6c98050e4120f0174fdc4498d.tar
nixlib-791c147cc27444b6c98050e4120f0174fdc4498d.tar.gz
nixlib-791c147cc27444b6c98050e4120f0174fdc4498d.tar.bz2
nixlib-791c147cc27444b6c98050e4120f0174fdc4498d.tar.lz
nixlib-791c147cc27444b6c98050e4120f0174fdc4498d.tar.xz
nixlib-791c147cc27444b6c98050e4120f0174fdc4498d.tar.zst
nixlib-791c147cc27444b6c98050e4120f0174fdc4498d.zip
Merge pull request #262838 from amjoseph-nixpkgs/pr/lib/systems/abi-suffix
lib/systems/parse.nix: add removeAbiSuffix, use it
Diffstat (limited to 'lib')
-rw-r--r--lib/systems/parse.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix
index 34bfd94b3ce5..b69ad669e187 100644
--- a/lib/systems/parse.nix
+++ b/lib/systems/parse.nix
@@ -29,6 +29,15 @@ let
       assert type.check value;
       setType type.name ({ inherit name; } // value));
 
+  # gnu-config will ignore the portion of a triple matching the
+  # regex `e?abi.*$` when determining the validity of a triple.  In
+  # other words, `i386-linuxabichickenlips` is a valid triple.
+  removeAbiSuffix = x:
+    let match = builtins.match "(.*)e?abi.*" x;
+    in if match==null
+       then x
+       else lib.elemAt match 0;
+
 in
 
 rec {
@@ -466,7 +475,7 @@ rec {
         else                     vendors.unknown;
       kernel = if hasPrefix "darwin" args.kernel      then getKernel "darwin"
                else if hasPrefix "netbsd" args.kernel then getKernel "netbsd"
-               else                                   getKernel args.kernel;
+               else                                   getKernel (removeAbiSuffix args.kernel);
       abi =
         /**/ if args ? abi       then getAbi args.abi
         else if isLinux parsed || isWindows parsed then