♻️ [shared] Refactor system configs
This commit is contained in:
@ -74,13 +74,11 @@
|
|||||||
systems = builtins.map (config: defaultAttrs // config) [
|
systems = builtins.map (config: defaultAttrs // config) [
|
||||||
{
|
{
|
||||||
hostName = "desktop";
|
hostName = "desktop";
|
||||||
system = "x86_64-linux";
|
|
||||||
nvidia.enable = true;
|
nvidia.enable = true;
|
||||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMSzXyTuQyTrWsfORQbvgrqt/33+hfSUDXeMg6D1T2wz";
|
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMSzXyTuQyTrWsfORQbvgrqt/33+hfSUDXeMg6D1T2wz";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
hostName = "thinkpad";
|
hostName = "thinkpad";
|
||||||
system = "x86_64-linux";
|
|
||||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNlHKE/BD8kKfhJD7GBk1A3whZf3gTjk9VEgGAj3qsH";
|
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNlHKE/BD8kKfhJD7GBk1A3whZf3gTjk9VEgGAj3qsH";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -88,16 +86,20 @@
|
|||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
wayland.enable = false;
|
wayland.enable = false;
|
||||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJE9m7YiITe1sDqSZ7Pa8luIw3WToLsypixZEqE4wCQE";
|
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJE9m7YiITe1sDqSZ7Pa8luIw3WToLsypixZEqE4wCQE";
|
||||||
|
address.private = common.localIpAddr 188;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
hostName = "homelab";
|
hostName = "homelab";
|
||||||
system = "x86_64-linux";
|
|
||||||
wayland.enable = false;
|
wayland.enable = false;
|
||||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIARDv5nRlfPDXdV+Db4FaqeSJZ3/3MO0frYGzuVeqYAl";
|
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIARDv5nRlfPDXdV+Db4FaqeSJZ3/3MO0frYGzuVeqYAl";
|
||||||
|
address.private = common.localIpAddr 231;
|
||||||
|
address.tailnet = common.tailnetAddr "admin";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
defaultAttrs = {
|
defaultAttrs = {
|
||||||
|
hostName = builtins.abort "hostName is required";
|
||||||
|
system = "x86_64-linux";
|
||||||
username = common.username;
|
username = common.username;
|
||||||
version = common.system.version;
|
version = common.system.version;
|
||||||
wayland.enable = true;
|
wayland.enable = true;
|
||||||
|
@ -15,13 +15,16 @@ with builtins;
|
|||||||
name = system.hostName;
|
name = system.hostName;
|
||||||
value =
|
value =
|
||||||
let
|
let
|
||||||
# TODO rename desktop to homelab
|
hostName =
|
||||||
hostName = if system.hostName == "homelab" then "admin" else system.hostName;
|
if (system ? address && system.address ? tailnet) then
|
||||||
|
system.address.tailnet
|
||||||
|
else
|
||||||
|
common.tailnetAddr system.hostName;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
port = 22;
|
port = 22;
|
||||||
user = systemConfig.username;
|
user = systemConfig.username;
|
||||||
hostname = "${hostName}.dns.${common.domain}";
|
hostname = hostName;
|
||||||
};
|
};
|
||||||
}) systems
|
}) systems
|
||||||
);
|
);
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
}:
|
}:
|
||||||
with builtins;
|
with builtins;
|
||||||
let
|
let
|
||||||
domain = "dns.${common.domain}";
|
|
||||||
allSystems = knownSystems ++ systems;
|
allSystems = knownSystems ++ systems;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@ -17,7 +16,12 @@ in
|
|||||||
name = system.hostName;
|
name = system.hostName;
|
||||||
value = {
|
value = {
|
||||||
extraHostNames = [
|
extraHostNames = [
|
||||||
"${system.hostName}.${domain}"
|
(
|
||||||
|
if (system ? address && system.address ? tailnet) then
|
||||||
|
system.address.tailnet
|
||||||
|
else
|
||||||
|
common.tailnetAddr system.hostName
|
||||||
|
)
|
||||||
];
|
];
|
||||||
publicKey = system.ssh.publicKey;
|
publicKey = system.ssh.publicKey;
|
||||||
};
|
};
|
||||||
|
@ -14,6 +14,10 @@ rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
domain = "martials.no";
|
domain = "martials.no";
|
||||||
|
tailnetDomain = "dns.${domain}";
|
||||||
|
localIpPrefix = "192.168.10.";
|
||||||
|
localIpAddr = subAddr: "${localIpPrefix}${builtins.toString subAddr}";
|
||||||
|
tailnetAddr = host: "${host}.${tailnetDomain}";
|
||||||
|
|
||||||
keymaps = {
|
keymaps = {
|
||||||
layout = "gb,no";
|
layout = "gb,no";
|
||||||
|
Reference in New Issue
Block a user