Flake: refactor nixos configurations

This commit is contained in:
Toast 2024-09-06 02:25:27 +02:00
parent 1aca0c5e64
commit 10902ed69f

151
flake.nix
View file

@ -134,116 +134,93 @@
discord-krisp-fixer = callPackage ./pkgs/discord-krisp-fixer {};
};
};
nixosConfigurations = {
Archie = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
systemPkgs = inputs.nixpkgs-unstable-raw;
flakeSelf = self;
nixosConfigurations = let
mkSystems = hosts:
builtins.mapAttrs (
host: settings: let
pkgs =
if isStable
then nixpkgs
else nixpkgs-unstable;
isStable = (settings ? stable) && (settings.stable == true);
in
mkSystem host settings.modules pkgs isStable
)
hosts;
mkSystem = host: modules: pkgs: stable:
pkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
systemPkgs =
if stable
then nixpkgs-patched
else nixpkgs-unstable-patched;
flakeSelf = self;
};
modules =
[
agenix.nixosModules.default
(
if stable
then home-manager
else home-manager-unstable
)
.nixosModule
(
if stable
then nix-index-db
else nix-index-db-unstable
)
.nixosModules
.nix-index
catppuccin.nixosModules.catppuccin
(
if stable
then lix-module
else lix-module-unstable
)
.nixosModules
.default
./roles/common
(./machines + "/${host}")
]
++ modules;
};
/*
I used to set up nixpkgs in the flake, but doing that made
defining overlays in modules impossible (or at least I could
not figure out how)
Also has nice side effect of making it easier to add new systems :3
*/
modules = [
agenix.nixosModules.default
home-manager-unstable.nixosModule
nix-index-db-unstable.nixosModules.nix-index
catppuccin.nixosModules.catppuccin
in
mkSystems {
Archie.modules = [
nixos-hardware.nixosModules.common-cpu-amd-zenpower
lix-module-unstable.nixosModules.default
./roles/common
./roles/desktop
./roles/kde
./roles/gaming
./machines/Archie
];
};
SurfaceGo = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
systemPkgs = inputs.nixpkgs-unstable-raw;
flakeSelf = self;
};
modules = [
agenix.nixosModules.default
home-manager-unstable.nixosModule
SurfaceGo.modules = [
nixos-hardware.nixosModules.microsoft-surface-go
nix-index-db-unstable.nixosModules.nix-index
catppuccin.nixosModules.catppuccin
lix-module-unstable.nixosModules.default
./roles/common
./roles/desktop
./roles/kde
./machines/SurfaceGo
];
};
SteamDeck = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
systemPkgs = inputs.nixpkgs-unstable-raw;
flakeSelf = self;
};
modules = [
agenix.nixosModules.default
SteamDeck.modules = [
jovian.nixosModules.default
home-manager-unstable.nixosModule
nix-index-db-unstable.nixosModules.nix-index
catppuccin.nixosModules.catppuccin
lix-module-unstable.nixosModules.default
./roles/common
./roles/desktop
./roles/kde
./roles/gaming
./machines/SteamDeck
];
};
WinMax2 = nixpkgs-unstable.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
systemPkgs = inputs.nixpkgs-unstable-raw;
flakeSelf = self;
};
modules = [
agenix.nixosModules.default
WinMax2.modules = [
jovian.nixosModules.default
home-manager-unstable.nixosModule
nix-index-db-unstable.nixosModules.nix-index
nixos-hardware.nixosModules.gpd-win-max-2-2023
catppuccin.nixosModules.catppuccin
lix-module-unstable.nixosModules.default
./roles/common
./roles/desktop
./roles/kde
./roles/gaming
./machines/WinMax2
];
};
Everest = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
systemPkgs = inputs.nixpkgs-raw;
flakeSelf = self;
Everest = {
stable = true;
modules = [
nix-minecraft.nixosModules.minecraft-servers
{nixpkgs.overlays = [nix-minecraft.overlay];}
./roles/server
];
};
modules = [
agenix.nixosModules.default
home-manager.nixosModule
nix-index-db.nixosModules.nix-index
catppuccin.nixosModules.catppuccin
lix-module.nixosModules.default
nix-minecraft.nixosModules.minecraft-servers
{nixpkgs.overlays = [nix-minecraft.overlay];}
./roles/common
./roles/server
./machines/Everest
];
};
};
};
}