Fix building with Colmena.

Apply overlays and nixpkgs imports once
Do not set hostPlatform explicitly, set it from the network.json file
This commit is contained in:
Greg Hellings
2025-12-22 15:27:36 -06:00
parent 264504050c
commit 856d4ec627
12 changed files with 58 additions and 43 deletions
+21 -6
View File
@@ -68,7 +68,7 @@
"x86_64-linux" "x86_64-linux"
"aarch64-darwin" "aarch64-darwin"
]; ];
nixpkgs = top.nixunstable.lib.genAttrs systems ( imported_packages = top.nixunstable.lib.genAttrs systems (
system: system:
import top.nixunstable { import top.nixunstable {
inherit system; inherit system;
@@ -88,7 +88,7 @@
colmenaHive = top.colmena.lib.makeHive ( colmenaHive = top.colmena.lib.makeHive (
{ {
meta = { meta = {
nixpkgs = nixpkgs.x86_64-linux; nixpkgs = imported_packages.x86_64-linux;
specialArgs = { specialArgs = {
inherit inherit
metadata metadata
@@ -117,11 +117,26 @@
) self.nixosConfigurations) ) self.nixosConfigurations)
); );
darwinConfigurations = (import ./darwin { inherit top nixpkgs; }); darwinConfigurations = (
import ./darwin {
inherit top;
nixpkgs = imported_packages;
}
);
nixosConfigurations = (import ./hosts { inherit top nixpkgs metadata; }); nixosConfigurations = (
import ./hosts {
inherit top metadata;
nixpkgs = imported_packages;
}
);
homeConfigurations = (import ./home { inherit top nixpkgs metadata; }); homeConfigurations = (
import ./home {
inherit top metadata;
nixpkgs = imported_packages;
}
);
modules = import ./modules; modules = import ./modules;
@@ -137,7 +152,7 @@
}: }:
{ {
_module.args = { _module.args = {
pkgs = nixpkgs.${system}; pkgs = imported_packages.${system};
}; };
packages = (import ./pkgs { inherit pkgs; }); packages = (import ./pkgs { inherit pkgs; });
+5 -11
View File
@@ -11,20 +11,17 @@ let
channel ? top.nixunstable, channel ? top.nixunstable,
extraMods ? [ ], extraMods ? [ ],
name, name,
system ? "x86_64-linux",
hm ? top.hmunstable, hm ? top.hmunstable,
}: }:
let
inherit (metadata.hosts.${name}) system;
in
channel.lib.nixosSystem { channel.lib.nixosSystem {
pkgs = nixpkgs.${system};
specialArgs = { specialArgs = {
inherit metadata top; inherit metadata top;
}; };
modules = [ modules = [
{
nixpkgs = {
inherit system;
pkgs = nixpkgs.${system};
};
}
# Imported ones # Imported ones
top.agenix.nixosModules.default top.agenix.nixosModules.default
hm.nixosModules.home-manager hm.nixosModules.home-manager
@@ -51,10 +48,7 @@ in
iso = unstable { name = "iso"; }; iso = unstable { name = "iso"; };
# nix build '.#nixosConfigurations.wsl.config.system.build.installer' # nix build '.#nixosConfigurations.wsl.config.system.build.installer'
nixos = wsl { nixos = wsl { name = "wsl"; };
name = "wsl";
system = "aarch64-linux";
};
# nix build '.#nixosConfigurations.wsl-aarch.config.system.build.installer' # nix build '.#nixosConfigurations.wsl-aarch.config.system.build.installer'
#nixos-arm = wsl { #nixos-arm = wsl {
#name = "wsl"; #name = "wsl";
-1
View File
@@ -43,6 +43,5 @@
# networking.interfaces.enp0s13f0u1.useDHCP = lib.mkDefault true; # networking.interfaces.enp0s13f0u1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp170s0.useDHCP = lib.mkDefault true; # networking.interfaces.wlp170s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
-2
View File
@@ -31,6 +31,4 @@
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.ens18.useDHCP = lib.mkDefault true; # networking.interfaces.ens18.useDHCP = lib.mkDefault true;
# networking.interfaces.ens19.useDHCP = lib.mkDefault true; # networking.interfaces.ens19.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
} }
-1
View File
@@ -50,6 +50,5 @@
# networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
-1
View File
@@ -93,6 +93,5 @@
# networking.interfaces.enp39s0.useDHCP = lib.mkDefault true; # networking.interfaces.enp39s0.useDHCP = lib.mkDefault true;
# networking.interfaces.enp42s0f3u5u3c2.useDHCP = lib.mkDefault true; # networking.interfaces.enp42s0f3u5u3c2.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
@@ -49,6 +49,5 @@
# networking.interfaces.enp68s0.useDHCP = lib.mkDefault true; # networking.interfaces.enp68s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo2.useDHCP = lib.mkDefault true; # networking.interfaces.wlo2.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }
@@ -47,6 +47,4 @@
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp6s18.useDHCP = lib.mkDefault true; # networking.interfaces.enp6s18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
} }
@@ -55,6 +55,4 @@
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp6s18.useDHCP = lib.mkDefault true; # networking.interfaces.enp6s18.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
} }
+25 -13
View File
@@ -19,32 +19,35 @@
"ip": "10.42.1.5", "ip": "10.42.1.5",
"ts": "100.88.91.27", "ts": "100.88.91.27",
"system": "x86_64-linux", "system": "x86_64-linux",
"tags": [ "router", "server" ] "tags": ["router", "server"]
}, },
"hosea": { "hosea": {
"ip": "10.42.1.7", "ip": "10.42.1.7",
"ts": "100.68.203.1", "ts": "100.68.203.1",
"system": "x86_64-linux", "system": "x86_64-linux",
"tags": [ "server" ] "tags": ["server"]
}, },
"icdm-root": { "icdm-root": {
"system": "x86_64-linux"
}, },
"isaiah": { "isaiah": {
"builder": true, "builder": true,
"ip": "10.42.1.6", "ip": "10.42.1.6",
"ts": "100.84.183.79", "ts": "100.84.183.79",
"system": "x86_64-linux", "system": "x86_64-linux",
"systems": [ "x86_64-linux", "aarch64-linux" ], "systems": ["x86_64-linux", "aarch64-linux"],
"tags": [ "builder", "kube", "server" ] "tags": ["builder", "kube", "server"]
},
"iso": {
"system": "x86_64-linux"
}, },
"iso": {},
"jeremiah": { "jeremiah": {
"builder": true, "builder": true,
"ip": "10.42.1.8", "ip": "10.42.1.8",
"ts": "100.102.186.39", "ts": "100.102.186.39",
"system": "x86_64-linux", "system": "x86_64-linux",
"systems": [ "x86_64-linux", "aarch64-linux" ], "systems": ["x86_64-linux", "aarch64-linux"],
"tags": [ "builder", "kube", "server" ] "tags": ["builder", "kube", "server"]
}, },
"joel": { "joel": {
"ip": "10.42.0.4", "ip": "10.42.0.4",
@@ -55,22 +58,31 @@
"ip": null, "ip": null,
"ts": "100.109.86.8", "ts": "100.109.86.8",
"system": "x86_64-linux", "system": "x86_64-linux",
"tags": [ "public", "server" ] "tags": ["public", "server"]
}, },
"nas1": { "nas1": {
"ip": "10.42.1.14", "ip": "10.42.1.14",
"ts": "100.114.187.61" "ts": "100.114.187.61"
}, },
"nixos": {}, "nixos": {
"proxmoxtemplate": {}, "system": "x86_64-linux"
"vm-gitlab": {}, },
"proxmoxtemplate": {
"system": "x86_64-linux"
},
"vm-gitlab": {
"system": "x86_64-linux"
},
"wsl": {
"system": "aarch64-linux"
},
"zeke": { "zeke": {
"builder": true, "builder": true,
"ip": "10.42.1.13", "ip": "10.42.1.13",
"ts": "100.90.74.19", "ts": "100.90.74.19",
"system": "x86_64-linux", "system": "x86_64-linux",
"systems": [ "x86_64-linux", "aarch64-linux" ], "systems": ["x86_64-linux", "aarch64-linux"],
"tags": [ "builder", "kube", "server" ] "tags": ["builder", "kube", "server"]
} }
} }
} }
+1 -1
View File
@@ -18,7 +18,7 @@ final: prev:
qemu = prev.qemu.override { sdlSupport = true; }; qemu = prev.qemu.override { sdlSupport = true; };
# Overrides of packages # Overrides of packages
attic-client = prev.attic-client.overrideAttrs { attic-client = prev.attic-client.overrideAttrs {
patches = prev.attic-client.patches ++ [ ./attic-client.patch ]; # patches = prev.attic-client.patches ++ [ ./attic-client.patch ];
}; };
libbluray-custom = prev.libbluray.override { libbluray-custom = prev.libbluray.override {
withAACS = true; withAACS = true;
+6 -2
View File
@@ -1,4 +1,8 @@
{ pkgs, ... }: {
pkgs,
system ? pkgs.stdenv.hostPlatform.system,
...
}:
let let
c = pkgs.callPackage; c = pkgs.callPackage;
@@ -19,7 +23,7 @@ in
upgrade-pg-cluster = c ./upgrade-pg-cluster.nix { }; upgrade-pg-cluster = c ./upgrade-pg-cluster.nix { };
} }
// ( // (
if pkgs.stdenv.hostPlatform.system == "x86_64-linux" then if system == "x86_64-linux" then
{ {
qemu-hook = c ./qemu-hook.nix { }; qemu-hook = c ./qemu-hook.nix { };
vfio_startup = c ./vfio_startup.nix { }; vfio_startup = c ./vfio_startup.nix { };