Compare commits
4 Commits
e4a4f79509
...
f3e78d5226
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3e78d5226
|
||
|
|
9ffa43acbb
|
||
|
|
d8690ad2df
|
||
|
|
9665025e13
|
@@ -69,41 +69,49 @@
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
};
|
||||
nixosConfigs = builtins.mapAttrs (
|
||||
hostname: nodeConfig: format:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self nix_builder;
|
||||
|
||||
this_nixos_config = self.nixosConfigurations."${hostname}";
|
||||
|
||||
all_nixos_configs = self.nixosConfigurations;
|
||||
};
|
||||
baseConfig = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self nix_builder;
|
||||
};
|
||||
modules = [
|
||||
impermanence.nixosModules.impermanence
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
disko.nixosModules.disko
|
||||
./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 = [
|
||||
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}";
|
||||
unoptimized = import nixpkgs {
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
hostPlatform.gcc.arch = "default";
|
||||
hostPlatform.gcc.tune = "default";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
) nodes;
|
||||
specialFormats =
|
||||
nixosConfig: format:
|
||||
nixosConfig.extendModules {
|
||||
modules = [ (./. + "/formats/${format}.nix") ];
|
||||
};
|
||||
installerConfig =
|
||||
hostname: nodeConfig:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
@@ -117,18 +125,32 @@
|
||||
};
|
||||
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;
|
||||
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage;
|
||||
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes))
|
||||
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)
|
||||
);
|
||||
in
|
||||
(
|
||||
machines
|
||||
// {
|
||||
wip = nixpkgs.legacyPackages."${system}".symlinkJoin {
|
||||
name = "wip";
|
||||
paths = [ self.nixosConfigurations."odo".config.system.build.toplevel ];
|
||||
};
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
this_nixos_config,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -50,6 +49,9 @@
|
||||
# ++ flakeOutPaths;
|
||||
# closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
|
||||
# in
|
||||
let
|
||||
this_nixos_config = self.nixosConfigurations."${config.networking.hostName}";
|
||||
in
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
all_nixos_configs,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -76,14 +76,14 @@ let
|
||||
sshUser = "nixworker";
|
||||
sshKey = "/persist/manual/ssh/root/keys/id_ed25519";
|
||||
maxJobs = 1;
|
||||
supportedFeatures = all_nixos_configs."${hostname}".config.me.optimizations.system_features;
|
||||
supportedFeatures = self.nixosConfigurations."${hostname}".config.me.optimizations.system_features;
|
||||
protocol = "ssh-ng";
|
||||
}
|
||||
static_host_configs."${hostname}"
|
||||
config.me.distributed_build.machines."${hostname}".additional_config
|
||||
]
|
||||
))
|
||||
) (builtins.attrNames all_nixos_configs)
|
||||
) (builtins.attrNames self.nixosConfigurations)
|
||||
);
|
||||
substituters_list = (
|
||||
map (
|
||||
@@ -92,7 +92,7 @@ let
|
||||
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))
|
||||
) (builtins.attrNames all_nixos_configs)
|
||||
) (builtins.attrNames self.nixosConfigurations)
|
||||
);
|
||||
has_any_substituters = substituters_list != [ ];
|
||||
in
|
||||
@@ -107,7 +107,9 @@ in
|
||||
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 (
|
||||
|
||||
@@ -80,6 +80,7 @@ in
|
||||
systemd.services."build-cache" =
|
||||
let
|
||||
enabled_targets = [
|
||||
"wip"
|
||||
"odo"
|
||||
"odo_update"
|
||||
"odowork"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
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]]
|
||||
name = "odo"
|
||||
repo = "https://code.fizz.buzz/talexander/machine_setup.git"
|
||||
|
||||
Reference in New Issue
Block a user