[shared] Refactor systems
This commit is contained in:
188
flake.nix
188
flake.nix
@@ -66,60 +66,20 @@
|
||||
lib = nixpkgs.lib.extend customLib;
|
||||
libHm = home-manager.lib.extend customLib;
|
||||
|
||||
systems = builtins.map (config: defaultAttrs // config) [
|
||||
{
|
||||
hostName = "desktop";
|
||||
nvidia.enable = true;
|
||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMSzXyTuQyTrWsfORQbvgrqt/33+hfSUDXeMg6D1T2wz";
|
||||
}
|
||||
{
|
||||
hostName = "thinkpad";
|
||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNlHKE/BD8kKfhJD7GBk1A3whZf3gTjk9VEgGAj3qsH";
|
||||
}
|
||||
{
|
||||
hostName = "pi4";
|
||||
system = "aarch64-linux";
|
||||
wayland.enable = false;
|
||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJE9m7YiITe1sDqSZ7Pa8luIw3WToLsypixZEqE4wCQE";
|
||||
address.private = common.localIpAddr 188;
|
||||
}
|
||||
{
|
||||
hostName = "homelab";
|
||||
wayland.enable = false;
|
||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIARDv5nRlfPDXdV+Db4FaqeSJZ3/3MO0frYGzuVeqYAl";
|
||||
address.private = common.localIpAddr 231;
|
||||
address.tailnet = common.tailnetAddr "admin";
|
||||
}
|
||||
{
|
||||
hostName = "nidaros";
|
||||
wayland.enable = false;
|
||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILw1iNuPnX9NGt+UAvBDzkk26d1e4nF+XX2FMm+IRWtt";
|
||||
address.private = common.localIpAddr 228;
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
defaultAttrs = {
|
||||
hostName = builtins.abort "hostName is required";
|
||||
system = "x86_64-linux";
|
||||
username = common.username;
|
||||
version = common.system.version;
|
||||
wayland.enable = true;
|
||||
nvidia.enable = false;
|
||||
systems = import ./systems.nix {
|
||||
inherit common;
|
||||
};
|
||||
|
||||
knownSystems = [
|
||||
{
|
||||
# Samsung S23 FE
|
||||
hostName = "localhost-y4maoyqm";
|
||||
knownSystems = {
|
||||
# Samsung S23 FE
|
||||
localhost-y4maoyqm = {
|
||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII7SSjiqnjif1Kko60iXVTKJ7a1/lRlR8TFNtoclNcnQ";
|
||||
}
|
||||
{
|
||||
# OnePlus 8
|
||||
hostName = "localhost-4izgka9k";
|
||||
};
|
||||
# OnePlus 8
|
||||
localhost-4izgka9k = {
|
||||
ssh.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIALtulVgLrUEpKnpfPFQTHjaEXTxs2Q818NC18eLx0bj";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
@@ -132,75 +92,71 @@
|
||||
#
|
||||
# ========= Host Configurations =========
|
||||
#
|
||||
nixosConfigurations = builtins.listToAttrs (
|
||||
builtins.map (
|
||||
{
|
||||
hostName,
|
||||
system,
|
||||
username,
|
||||
...
|
||||
}@systemConfig:
|
||||
nixosConfigurations = builtins.mapAttrs (
|
||||
hostName:
|
||||
{
|
||||
system,
|
||||
username,
|
||||
...
|
||||
}@systemConfig:
|
||||
|
||||
{
|
||||
name = hostName;
|
||||
value = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit
|
||||
outputs
|
||||
inputs
|
||||
common
|
||||
theme
|
||||
lib
|
||||
systemConfig
|
||||
systems
|
||||
knownSystems
|
||||
;
|
||||
isDarwin = false;
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit
|
||||
outputs
|
||||
inputs
|
||||
common
|
||||
theme
|
||||
lib
|
||||
hostName
|
||||
systemConfig
|
||||
systems
|
||||
knownSystems
|
||||
;
|
||||
isDarwin = false;
|
||||
};
|
||||
modules = [
|
||||
./hosts/${hostName}
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager = {
|
||||
# Backups conflicting files in case of error
|
||||
backupFileExtension = "bkp";
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
common
|
||||
theme
|
||||
libHm
|
||||
systemConfig
|
||||
systems
|
||||
;
|
||||
};
|
||||
users.${username} = import ./hosts/${hostName}/home-manager;
|
||||
};
|
||||
modules = [
|
||||
./hosts/${hostName}
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager = {
|
||||
# Backups conflicting files in case of error
|
||||
backupFileExtension = "bkp";
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
common
|
||||
theme
|
||||
libHm
|
||||
systemConfig
|
||||
systems
|
||||
;
|
||||
};
|
||||
users.${username} = import ./hosts/${hostName}/home-manager;
|
||||
};
|
||||
}
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
# TODO temp fix for tailscale: https://github.com/tailscale/tailscale/issues/16966#issuecomment-3239543750
|
||||
(_: prev: {
|
||||
tailscale = prev.tailscale.overrideAttrs (old: {
|
||||
checkFlags = builtins.map (
|
||||
flag:
|
||||
if prev.lib.hasPrefix "-skip=" flag then
|
||||
flag + "|^TestGetList$|^TestIgnoreLocallyBoundPorts$|^TestPoller$"
|
||||
else
|
||||
flag
|
||||
) old.checkFlags;
|
||||
});
|
||||
})
|
||||
];
|
||||
}
|
||||
}
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
# TODO temp fix for tailscale: https://github.com/tailscale/tailscale/issues/16966#issuecomment-3239543750
|
||||
(_: prev: {
|
||||
tailscale = prev.tailscale.overrideAttrs (old: {
|
||||
checkFlags = builtins.map (
|
||||
flag:
|
||||
if prev.lib.hasPrefix "-skip=" flag then
|
||||
flag + "|^TestGetList$|^TestIgnoreLocallyBoundPorts$|^TestPoller$"
|
||||
else
|
||||
flag
|
||||
) old.checkFlags;
|
||||
});
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
) systems
|
||||
);
|
||||
}
|
||||
];
|
||||
}
|
||||
) systems;
|
||||
|
||||
#
|
||||
# ========= Formatting =========
|
||||
|
Reference in New Issue
Block a user