Refactor.

This commit is contained in:
Nolan Darilek 2025-07-18 09:42:07 -04:00
parent 46dc54ccca
commit acb5021913

131
flake.nix
View file

@ -30,91 +30,68 @@
config.android_sdk.accept_license = true; config.android_sdk.accept_license = true;
}; };
}; };
# Common modules shared across all hosts
commonModules = [
agenix.nixosModules.default
{
environment.systemPackages = [ agenix.packages.${system}.default ];
}
(
{ config, pkgs, ... }:
{
nixpkgs.overlays = [ overlayUnstable ];
}
)
];
# Common home-manager modules
homeManagerModules = [
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
# Helper function to create a host configuration
mkHost =
{
hostPath,
extraModules ? [ ],
includeHomeManager ? true,
specialArgs ? { },
}:
nixpkgs.lib.nixosSystem {
inherit system specialArgs;
modules =
commonModules
++ (if includeHomeManager then homeManagerModules else [ ])
++ extraModules
++ [ hostPath ];
};
in in
{ {
nixosConfigurations = { nixosConfigurations = {
nixbox = nixpkgs.lib.nixosSystem { nixbox = mkHost {
inherit system; hostPath = ./hosts/nixbox;
modules = [
agenix.nixosModules.default
{
environment.systemPackages = [ agenix.packages.${system}.default ];
}
(
{ config, pkgs, ... }:
{
nixpkgs.overlays = [ overlayUnstable ];
}
)
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
./hosts/nixbox
];
}; };
flynode = nixpkgs.lib.nixosSystem {
inherit system; flynode = mkHost {
modules = [ hostPath = ./hosts/flynode;
agenix.nixosModules.default extraModules = [ nixos-hardware.nixosModules.lenovo-thinkpad-z13-gen1 ];
{
environment.systemPackages = [ agenix.packages.${system}.default ];
}
(
{ config, pkgs, ... }:
{
nixpkgs.overlays = [ overlayUnstable ];
}
)
nixos-hardware.nixosModules.lenovo-thinkpad-z13-gen1
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
./hosts/flynode
];
}; };
thewordnerd = nixpkgs.lib.nixosSystem {
inherit system; thewordnerd = mkHost {
hostPath = ./hosts/hub;
extraModules = [ simple-nixos-mailserver.nixosModule ];
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [
agenix.nixosModules.default
{
environment.systemPackages = [ agenix.packages.${system}.default ];
}
(
{ config, pkgs, ... }:
{
nixpkgs.overlays = [ overlayUnstable ];
}
)
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
simple-nixos-mailserver.nixosModule
./hosts/hub
];
}; };
garden = nixpkgs.lib.nixosSystem {
inherit system; garden = mkHost {
hostPath = ./hosts/garden;
includeHomeManager = false;
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [
agenix.nixosModules.default
{
environment.systemPackages = [ agenix.packages.${system}.default ];
}
(
{ config, pkgs, ... }:
{
nixpkgs.overlays = [ overlayUnstable ];
}
)
./hosts/garden
];
}; };
}; };
}; };