Skip to content

Commit

Permalink
Use hostname to resolve core configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Oct 30, 2024
1 parent 50dbe6f commit 7c13743
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,23 @@
})
// (
let
nhw-mod = nixos-hardware.nixosModules;

mk-base-paths = hostname: let
key = pkgs.lib.toLower hostname;
in [
./system/_${key}.nix
./hardware/${key}.hardware-configuration.nix
];


mk-system = hostname: specific-modules:
nixpkgs.lib.nixosSystem {
specialArgs = {
inherit catppuccin username pkgs;
};

modules = [
./system
modules = [ ./system ] ++ (mk-base-paths hostname) ++ [
{ networking.hostName = hostname; }
{ nixpkgs.hostPlatform = system; }
] ++ [
Expand All @@ -134,28 +143,19 @@
in
{
nixosConfigurations = {
Sigmachine = mk-system "Sigmachine" ([
./system/_sigmachine.nix
./hardware/sigmachine.hardware-configuration.nix
] ++ (with nixos-hardware.nixosModules; [
Sigmachine = mk-system "Sigmachine" (with nhw-mod; [
asus-battery
common-pc-laptop
common-cpu-amd
common-pc-ssd
]));
]);

Bacon = mk-system "Bacon" ([
./system/_bacon.nix
./hardware/bacon.hardware-configuration.nix
] ++ (with nixos-hardware.nixosModules; [
Bacon = mk-system "Bacon" (with nhw-mod; [
common-cpu-intel
common-pc-ssd
]));
]);

Toaster = mk-system "Toaster" [
./system/_toaster.nix
./hardware/toaster.hardware-configuration.nix
];
Toaster = mk-system "Toaster" [ ];
};
}
);
Expand Down

0 comments on commit 7c13743

Please sign in to comment.