From 6a5196a1ce6cb76af6a503c936c94cba131b9ef1 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Mon, 20 Dec 2021 23:18:03 +0000 Subject: [PATCH] feat: crosscompilation support --- --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, rust-overlay, flake-utils, nixpkgs }: with nixpkgs.lib; rec { - lib = import ./lib; + lib = import ./lib { inherit flake-utils; }; } // flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs --- a/lib/default.nix +++ b/lib/default.nix @@ -1,9 +1,9 @@ -{ +{ flake-utils }: { fleetConfiguration = { data, nixpkgs, hosts, ... }@allConfig: let config = builtins.removeAttrs allConfig [ "nixpkgs" "data" ]; in - rec { + flake-utils.lib.eachDefaultSystem (system: rec { root = nixpkgs.lib.evalModules { modules = (import ../modules/fleet/_modules.nix) ++ [ config data ]; specialArgs = { @@ -25,11 +25,18 @@ modules = configuredHosts.${name}.modules ++ ( if configuredHosts.${name}.system == "aarch64-linux" then [ (nixpkgs + "/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix") ] else [ ] - ); + ) ++ [ + ({ ... }: { + nixpkgs.localSystem.system = system; + nixpkgs.crossSystem = if system == configuredHosts.${name}.system then null else { + system = configuredHosts.${name}.system; + }; + }) + ]; }; } ) (builtins.attrNames root.config.hosts) ); #nixpkgs.lib.nixosSystem {} - }; + }); } -- gitstuff