mirror of
https://github.com/tuxdotrs/nix-config.git
synced 2026-09-20 00:59:04 +05:30
refactor(hosts): streamline host and node builders
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
inputs,
|
inputs,
|
||||||
outputs,
|
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
mkHost =
|
mkNixOSHost =
|
||||||
hostName:
|
hostName:
|
||||||
{
|
{
|
||||||
userName ? "tux",
|
userName ? "tux",
|
||||||
@@ -55,8 +54,6 @@ let
|
|||||||
};
|
};
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit
|
inherit
|
||||||
inputs
|
|
||||||
outputs
|
|
||||||
hostName
|
hostName
|
||||||
userName
|
userName
|
||||||
userEmail
|
userEmail
|
||||||
@@ -68,20 +65,31 @@ let
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
mkNixOSNode = hostname: {
|
mkNixOSNode =
|
||||||
inherit hostname;
|
hostName:
|
||||||
|
{
|
||||||
|
system ? "x86_64-linux",
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
hostname = hostName;
|
||||||
profiles.system = {
|
profiles.system = {
|
||||||
user = "root";
|
user = "root";
|
||||||
path = inputs.deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.${hostname};
|
path = inputs.deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.${hostName};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
activateNixOnDroid =
|
activateNixOnDroid =
|
||||||
configuration:
|
system: configuration:
|
||||||
inputs.deploy-rs.lib.aarch64-linux.activate.custom configuration.activationPackage "${configuration.activationPackage}/activate";
|
inputs.deploy-rs.lib.${system}.activate.custom configuration.activationPackage
|
||||||
|
"${configuration.activationPackage}/activate";
|
||||||
|
|
||||||
mkDroidNode = hostname: {
|
mkDroidNode =
|
||||||
inherit hostname;
|
hostName:
|
||||||
|
{
|
||||||
|
system ? "aarch64-linux",
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
hostname = hostName;
|
||||||
profiles.system = {
|
profiles.system = {
|
||||||
sshUser = "nix-on-droid";
|
sshUser = "nix-on-droid";
|
||||||
user = "nix-on-droid";
|
user = "nix-on-droid";
|
||||||
@@ -90,13 +98,14 @@ let
|
|||||||
"-p"
|
"-p"
|
||||||
"8033"
|
"8033"
|
||||||
];
|
];
|
||||||
path = activateNixOnDroid self.nixOnDroidConfigurations.${hostname};
|
path = activateNixOnDroid system self.nixOnDroidConfigurations.${hostName};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake = {
|
flake = {
|
||||||
nixosConfigurations = builtins.mapAttrs mkHost {
|
nixosConfigurations = builtins.mapAttrs mkNixOSHost {
|
||||||
sirius = { };
|
sirius = { };
|
||||||
canopus = { };
|
canopus = { };
|
||||||
arcturus = { };
|
arcturus = { };
|
||||||
@@ -108,18 +117,14 @@ in
|
|||||||
vega = { };
|
vega = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
deploy.nodes = {
|
deploy.nodes =
|
||||||
sirius = mkNixOSNode "sirius";
|
builtins.mapAttrs (hostName: _: mkNixOSNode hostName { }) self.nixosConfigurations
|
||||||
canopus = mkNixOSNode "canopus";
|
// builtins.mapAttrs (hostName: _: mkDroidNode hostName { }) self.nixOnDroidConfigurations;
|
||||||
arcturus = mkNixOSNode "arcturus";
|
|
||||||
alpha = mkNixOSNode "alpha";
|
|
||||||
vega = mkDroidNode "vega";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = {
|
perSystem = {
|
||||||
checks = builtins.mapAttrs (
|
checks = builtins.mapAttrs (
|
||||||
_: config: config.config.system.build.toplevel
|
_: hostConfig: hostConfig.config.system.build.toplevel
|
||||||
) self.nixosConfigurations;
|
) self.nixosConfigurations;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user