Apply the same fixes to kubernetes.

This commit is contained in:
Tom Alexander
2026-11-12 14:17:23 -05:00
parent f3e78d5226
commit 1965d29c43
4 changed files with 65 additions and 81 deletions

View File

@@ -45,7 +45,14 @@
...
}:
let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
forAllSystems =
func:
builtins.listToAttrs (
map (system: {
name = system;
value = func system;
}) nixpkgs.lib.systems.flakeExposed
);
nodes = {
odo = {
system = "x86_64-linux";

View File

@@ -1 +0,0 @@
{ }

View File

@@ -71,26 +71,17 @@
system = "x86_64-linux";
};
};
nixosConfigs = builtins.mapAttrs (
hostname: nodeConfig: format:
nixpkgs.lib.nixosSystem {
baseConfig = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit self;
this_nixos_config = self.nixosConfigurations."${hostname}";
all_nixos_configs = self.nixosConfigurations;
};
modules = [
impermanence.nixosModules.impermanence
lanzaboote.nixosModules.lanzaboote
disko.nixosModules.disko
./configuration.nix
(./. + "/hosts/${hostname}")
(./. + "/formats/${format}.nix")
{
config = {
nixpkgs.hostPlatform.system = nodeConfig.system;
nixpkgs.overlays = [
(final: prev: {
# stable = nixpkgs-stable.legacyPackages."${prev.stdenv.hostPlatform.system}";
@@ -103,32 +94,26 @@
];
};
}
(
{
config,
lib,
pkgs,
...
}:
let
nix-self-repl = pkgs.writeShellScriptBin "nix-self-repl" ''
source /etc/set-environment
nix repl --expr 'builtins.getFlake "${self}"'
'';
# If we wanted the current version of a flake then we'd just launch
# nix repl
# and then run:
# :lf /path/to/flake
in
];
};
toplevelConfigs = builtins.mapAttrs (
hostname: nodeConfig:
baseConfig.extendModules {
modules = [
(./. + "/hosts/${hostname}")
{
config = {
environment.systemPackages = lib.mkIf config.nix.enable [ nix-self-repl ];
nixpkgs.hostPlatform.system = nodeConfig.system;
};
}
)
];
}
) nodes;
specialFormats =
nixosConfig: format:
nixosConfig.extendModules {
modules = [ (./. + "/formats/${format}.nix") ];
};
installerConfig =
hostname: nodeConfig:
nixpkgs.lib.nixosSystem {
@@ -137,46 +122,40 @@
};
modules = [
./formats/installer.nix
(
{
config,
lib,
pkgs,
...
}:
let
nix-self-repl = pkgs.writeShellScriptBin "nix-self-repl" ''
source /etc/set-environment
nix repl --expr 'builtins.getFlake "${self}"'
'';
# If we wanted the current version of a flake then we'd just launch
# nix repl
# and then run:
# :lf /path/to/flake
in
{
config = {
environment.systemPackages = lib.mkIf config.nix.enable [ nix-self-repl ];
};
}
)
({ nixpkgs.hostPlatform.system = nodeConfig.system; })
];
};
in
{
nixosConfigurations = (builtins.mapAttrs (name: value: value "toplevel") nixosConfigs);
nixosConfigurations = toplevelConfigs;
}
// {
packages = (
forAllSystems (
system:
(builtins.mapAttrs (hostname: nodeConfig: {
iso = (nixosConfigs."${hostname}" "iso").config.system.build.isoImage;
vm_iso = (nixosConfigs."${hostname}" "vm_iso").config.system.build.isoImage;
sd = (nixosConfigs."${hostname}" "sd").config.system.build.sdImage;
let
machines = (
builtins.mapAttrs (hostname: nodeConfig: {
iso = (specialFormats self.nixosConfigurations."${hostname}" "iso").config.system.build.isoImage;
vm_iso =
(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))
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes)
);
in
(
machines
// {
wip = nixpkgs.legacyPackages."${system}".symlinkJoin {
name = "wip";
paths = [
self.nixosConfigurations."controller0".config.system.build.toplevel
self.nixosConfigurations."worker0".config.system.build.toplevel
];
};
}
)
)
);
};

View File

@@ -1 +0,0 @@
{ }