about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-10-16T13·29+0100
committerflokli <flokli@flokli.de>2023-10-30T10·43+0000
commit18d582f96bb8c4351ca3e698c5d192d531883c02 (patch)
tree35faf216028670fa7bd247b1588f7c273f66aa4c
parent71fa4110fade5cafe0f1ec4c4a67f0b8bef86a35 (diff)
feat(third_party/nixpkgs): allow setting crossSystem r/6908
This allows cross-compiling depot targets to other architectures, so
`nix-build --argstr crossSystem aarch64-linux -A tvix.nar-bridge`
will emit a cross-compiled aarch64-linux binary.

There's still some other cross-related issues in crate2nix to sort out
for crate2nix builds, but this CL can already land.

Co-Authored-By: raitobezarius <tvl@lahfa.xyz>
Change-Id: I467d49d125dd707a4142bfde18eea4a1c3afaf70
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9755
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
-rw-r--r--default.nix3
-rw-r--r--third_party/nixpkgs/default.nix3
2 files changed, 4 insertions, 2 deletions
diff --git a/default.nix b/default.nix
index 0cb74ee731d7..c4db2fa58017 100644
--- a/default.nix
+++ b/default.nix
@@ -6,6 +6,7 @@
 , parentTargetMap ? null
 , nixpkgsConfig ? { }
 , localSystem ? builtins.currentSystem
+, crossSystem ? null
 , ...
 }@args:
 
@@ -78,7 +79,7 @@ let
 
 in
 readTree.fix (self: (readDepot {
-  inherit localSystem;
+  inherit localSystem crossSystem;
   depot = self;
 
   # Pass third_party as 'pkgs' (for compatibility with external
diff --git a/third_party/nixpkgs/default.nix b/third_party/nixpkgs/default.nix
index 3fc2aaf7a8fd..84bd500cbf7f 100644
--- a/third_party/nixpkgs/default.nix
+++ b/third_party/nixpkgs/default.nix
@@ -12,6 +12,7 @@
 , externalArgs ? { }
 , depotOverlays ? true
 , localSystem ? externalArgs.localSystem or builtins.currentSystem
+, crossSystem ? externalArgs.crossSystem or localSystem
 , ...
 }:
 
@@ -31,7 +32,7 @@ let
         checkMeta = false;
       };
 
-    inherit localSystem;
+    inherit localSystem crossSystem;
   };
 
   # import the nixos-unstable package set, or optionally use the