4 Commits

Author SHA1 Message Date
Tom Alexander
f3e78d5226 Add a "wip" target in nix_builder for testing updates. 2026-11-12 13:56:38 -05:00
Tom Alexander
9ffa43acbb Eliminate this_nixos_config as a specialArg. 2026-11-12 13:49:48 -05:00
Tom Alexander
d8690ad2df Eliminate all_nixos_configs. 2026-11-12 13:46:00 -05:00
Tom Alexander
9665025e13 Rework flake.nix to use extendModules. 2026-11-12 13:42:37 -05:00
5 changed files with 72 additions and 38 deletions

View File

@@ -69,41 +69,49 @@
system = "x86_64-linux"; system = "x86_64-linux";
}; };
}; };
nixosConfigs = builtins.mapAttrs ( baseConfig = nixpkgs.lib.nixosSystem {
hostname: nodeConfig: format: specialArgs = {
nixpkgs.lib.nixosSystem { inherit self nix_builder;
specialArgs = { };
inherit self nix_builder; modules = [
impermanence.nixosModules.impermanence
this_nixos_config = self.nixosConfigurations."${hostname}"; lanzaboote.nixosModules.lanzaboote
disko.nixosModules.disko
all_nixos_configs = self.nixosConfigurations; ./configuration.nix
}; {
config = {
nixpkgs.overlays = [
(final: prev: {
# stable = nixpkgs-stable.legacyPackages."${prev.stdenv.hostPlatform.system}";
unoptimized = import nixpkgs {
system = prev.stdenv.hostPlatform.system;
hostPlatform.gcc.arch = "default";
hostPlatform.gcc.tune = "default";
};
})
];
};
}
];
};
toplevelConfigs = builtins.mapAttrs (
hostname: nodeConfig:
baseConfig.extendModules {
modules = [ modules = [
impermanence.nixosModules.impermanence
lanzaboote.nixosModules.lanzaboote
disko.nixosModules.disko
./configuration.nix
(./. + "/hosts/${hostname}") (./. + "/hosts/${hostname}")
(./. + "/formats/${format}.nix")
{ {
config = { config = {
nixpkgs.hostPlatform.system = nodeConfig.system; nixpkgs.hostPlatform.system = nodeConfig.system;
nixpkgs.overlays = [
(final: prev: {
# stable = nixpkgs-stable.legacyPackages."${prev.stdenv.hostPlatform.system}";
unoptimized = import nixpkgs {
system = prev.stdenv.hostPlatform.system;
hostPlatform.gcc.arch = "default";
hostPlatform.gcc.tune = "default";
};
})
];
}; };
} }
]; ];
} }
) nodes; ) nodes;
specialFormats =
nixosConfig: format:
nixosConfig.extendModules {
modules = [ (./. + "/formats/${format}.nix") ];
};
installerConfig = installerConfig =
hostname: nodeConfig: hostname: nodeConfig:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
@@ -117,18 +125,32 @@
}; };
in in
{ {
nixosConfigurations = (builtins.mapAttrs (name: value: value "toplevel") nixosConfigs); nixosConfigurations = toplevelConfigs;
} }
// { // {
packages = ( packages = (
forAllSystems ( forAllSystems (
system: system:
(builtins.mapAttrs (hostname: nodeConfig: { let
iso = (nixosConfigs."${hostname}" "iso").config.system.build.isoImage; machines = (
vm_iso = (nixosConfigs."${hostname}" "vm_iso").config.system.build.isoImage; builtins.mapAttrs (hostname: nodeConfig: {
sd = (nixosConfigs."${hostname}" "sd").config.system.build.sdImage; iso = (specialFormats self.nixosConfigurations."${hostname}" "iso").config.system.build.isoImage;
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage; vm_iso =
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes)) (specialFormats self.nixosConfigurations."${hostname}" "vm_iso").config.system.build.isoImage;
sd = (specialFormats self.nixosConfigurations."${hostname}" "sd").config.system.build.sdImage;
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage;
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes)
);
in
(
machines
// {
wip = nixpkgs.legacyPackages."${system}".symlinkJoin {
name = "wip";
paths = [ self.nixosConfigurations."odo".config.system.build.toplevel ];
};
}
)
) )
); );
}; };

View File

@@ -3,7 +3,6 @@
lib, lib,
pkgs, pkgs,
self, self,
this_nixos_config,
... ...
}: }:
@@ -50,6 +49,9 @@
# ++ flakeOutPaths; # ++ flakeOutPaths;
# closureInfo = pkgs.closureInfo { rootPaths = dependencies; }; # closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
# in # in
let
this_nixos_config = self.nixosConfigurations."${config.networking.hostName}";
in
{ {
imports = [ ]; imports = [ ];

View File

@@ -1,8 +1,8 @@
{ {
config, config,
lib, lib,
all_nixos_configs,
pkgs, pkgs,
self,
... ...
}: }:
@@ -76,14 +76,14 @@ let
sshUser = "nixworker"; sshUser = "nixworker";
sshKey = "/persist/manual/ssh/root/keys/id_ed25519"; sshKey = "/persist/manual/ssh/root/keys/id_ed25519";
maxJobs = 1; maxJobs = 1;
supportedFeatures = all_nixos_configs."${hostname}".config.me.optimizations.system_features; supportedFeatures = self.nixosConfigurations."${hostname}".config.me.optimizations.system_features;
protocol = "ssh-ng"; protocol = "ssh-ng";
} }
static_host_configs."${hostname}" static_host_configs."${hostname}"
config.me.distributed_build.machines."${hostname}".additional_config config.me.distributed_build.machines."${hostname}".additional_config
] ]
)) ))
) (builtins.attrNames all_nixos_configs) ) (builtins.attrNames self.nixosConfigurations)
); );
substituters_list = ( substituters_list = (
map ( map (
@@ -92,7 +92,7 @@ let
config.me.distributed_build.machines."${hostname}".enable_substituter config.me.distributed_build.machines."${hostname}".enable_substituter
&& config.me.distributed_build.machines."${hostname}".substituter_url != null && config.me.distributed_build.machines."${hostname}".substituter_url != null
) (config.me.distributed_build.machines."${hostname}".substituter_url)) ) (config.me.distributed_build.machines."${hostname}".substituter_url))
) (builtins.attrNames all_nixos_configs) ) (builtins.attrNames self.nixosConfigurations)
); );
has_any_substituters = substituters_list != [ ]; has_any_substituters = substituters_list != [ ];
in in
@@ -107,7 +107,9 @@ in
description = "Whether we want to use multiple machines to perform a nixos-rebuild."; description = "Whether we want to use multiple machines to perform a nixos-rebuild.";
}; };
distributed_build.machines = lib.mapAttrs (name: value: make_machine_config name) all_nixos_configs; distributed_build.machines = lib.mapAttrs (
name: value: make_machine_config name
) self.nixosConfigurations;
}; };
config = lib.mkIf config.me.distributed_build.enable ( config = lib.mkIf config.me.distributed_build.enable (

View File

@@ -80,6 +80,7 @@ in
systemd.services."build-cache" = systemd.services."build-cache" =
let let
enabled_targets = [ enabled_targets = [
"wip"
"odo" "odo"
"odo_update" "odo_update"
"odowork" "odowork"

View File

@@ -1,5 +1,12 @@
output_directory = "/home/nixworker/persist/nix_builder" output_directory = "/home/nixworker/persist/nix_builder"
[[targets]]
name = "wip"
repo = "https://code.fizz.buzz/talexander/machine_setup.git"
branch = "wip"
path = "nix/configuration"
attr = "wip"
[[targets]] [[targets]]
name = "odo" name = "odo"
repo = "https://code.fizz.buzz/talexander/machine_setup.git" repo = "https://code.fizz.buzz/talexander/machine_setup.git"