From 1180540ce34445fa7e2818686ad109b02e3cacf3 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 25 Mar 2023 16:18:52 +0100 Subject: [PATCH] Make sure we can use nix cache for non-cross-compiling --- flake.lock | 21 +-------------------- flake.nix | 4 +--- nix/pkgs.nix | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index a56cec5..5999137 100644 --- a/flake.lock +++ b/flake.lock @@ -1,25 +1,6 @@ { "nodes": { - "root": { - "inputs": { - "utils": "utils" - } - }, - "utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - } + "root": {} }, "root": "root", "version": 7 diff --git a/flake.nix b/flake.nix index 938e0c7..abe0f63 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,8 @@ { - inputs.utils.url = "github:numtide/flake-utils"; - description = "cryptic-net provides the foundation for an autonomous community cloud infrastructure"; outputs = { - self, utils, + self, }: let supportedSystems = (import ./nix/pkgs.nix).supportedSystems; diff --git a/nix/pkgs.nix b/nix/pkgs.nix index 3a36e49..2c55f95 100644 --- a/nix/pkgs.nix +++ b/nix/pkgs.nix @@ -45,9 +45,18 @@ rec { default = { buildSystem, hostSystem ? buildSystem, - }: import src { + }: import src ({ + + inherit overlays; system = buildSystem; + + } // (if buildSystem == hostSystem then {} else { + + # The nixpkgs cache doesn't have any packages where cross-compiling has been + # enabled, even if the target platform is actually the same as the build + # platform (and therefore it's not really cross-compiling). So we only set + # up the cross-compiling config if the target platform is different. crossSystem.config = hostSystem; - inherit overlays; - }; + + })); }