Add cross-compilation support

This commit is contained in:
Kyle Finlay 2024-11-04 13:54:45 +11:00
parent db08995cd6
commit 33f50ddcca

View file

@ -43,10 +43,19 @@
outputs = srcs@{ self, ... }: outputs = srcs@{ self, ... }:
let let
hostSystem = "x86_64-linux";
targetSystem = "aarch64-linux";
hostPkgs = import srcs.nixpkgs {
system = hostSystem;
};
pinned = import srcs.nixpkgs { pinned = import srcs.nixpkgs {
system = "aarch64-linux"; system = hostSystem;
crossSystem = { config = "aarch64-unknown-linux-gnu"; };
overlays = with self.overlays; [ core libcamera ]; overlays = with self.overlays; [ core libcamera ];
}; };
in in
{ {
overlays = { overlays = {
@ -59,9 +68,10 @@
libcamera-overlay = self.overlays.libcamera; libcamera-overlay = self.overlays.libcamera;
}; };
nixosConfigurations = { nixosConfigurations = {
rpi-example = srcs.nixpkgs.lib.nixosSystem { rpi-example = pinned.lib.nixosSystem {
system = "aarch64-linux"; system = targetSystem;
modules = [ self.nixosModules.raspberry-pi ./example ]; modules = [ self.nixosModules.raspberry-pi ./example ];
pkgs = pinned;
}; };
}; };
checks.aarch64-linux = self.packages.aarch64-linux; checks.aarch64-linux = self.packages.aarch64-linux;