git.delta.rocks / fleet / refs/commits / 6a5196a1ce6c

difftreelog

feat crosscompilation support

Yaroslav Bolyukin2021-12-20parent: #41ecf40.patch.diff

2 files changed

modifiedflake.nixdiffbeforeafterboth
7 flake-utils.url = "github:numtide/flake-utils";7 flake-utils.url = "github:numtide/flake-utils";
8 };8 };
9 outputs = { self, rust-overlay, flake-utils, nixpkgs }: with nixpkgs.lib; rec {9 outputs = { self, rust-overlay, flake-utils, nixpkgs }: with nixpkgs.lib; rec {
10 lib = import ./lib;10 lib = import ./lib { inherit flake-utils; };
11 } // flake-utils.lib.eachDefaultSystem (system:11 } // flake-utils.lib.eachDefaultSystem (system:
12 let12 let
13 pkgs = import nixpkgs13 pkgs = import nixpkgs
modifiedlib/default.nixdiffbeforeafterboth
--- 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 {}
-    };
+    });
 }