2024-07-21 20:23:33 +00:00
|
|
|
{ nixpkgs, ... }@inputs:
|
|
|
|
|
|
|
|
let
|
2024-07-21 21:18:23 +00:00
|
|
|
lib = nixpkgs.lib.extend (import ../lib);
|
2024-07-21 20:23:33 +00:00
|
|
|
in
|
|
|
|
rec {
|
|
|
|
toPartialNixosConfig =
|
|
|
|
{ hostname, system }:
|
|
|
|
{
|
|
|
|
name = hostname;
|
|
|
|
value = nixpkgs.lib.nixosSystem {
|
|
|
|
inherit system;
|
2024-07-24 07:16:52 +00:00
|
|
|
specialArgs = { inherit inputs lib; };
|
2024-07-21 20:23:33 +00:00
|
|
|
modules = [
|
|
|
|
../hosts/${hostname}/hardware-configuration.nix
|
|
|
|
../hosts/${hostname}/configuration.nix
|
|
|
|
inputs.home-manager.nixosModules.default
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
compileSystems =
|
|
|
|
systems:
|
|
|
|
lib.right
|
|
|
|
builtins.listToAttrs
|
|
|
|
(map toPartialNixosConfig)
|
|
|
|
systems;
|
2024-07-21 21:19:02 +00:00
|
|
|
|
|
|
|
toPartialHomeManagerConfig =
|
|
|
|
{ user, system, hostname ? "", configHostname ? "" }:
|
|
|
|
let
|
|
|
|
configHost = if builtins.stringLength configHostname > 0 then configHostname else hostname;
|
|
|
|
hostStr = lib.strings.optionalString (builtins.stringLength hostname > 0) "@${hostname}";
|
|
|
|
in
|
2024-07-22 07:05:45 +00:00
|
|
|
assert lib.assertMsg (builtins.stringLength configHost > 0) "either configHostname or hostname need to exist";
|
2024-07-21 21:19:02 +00:00
|
|
|
{
|
|
|
|
name = "${user}${hostStr}";
|
|
|
|
value = inputs.home-manager.lib.homeManagerConfiguration {
|
|
|
|
pkgs = nixpkgs.legacyPackages."${system}";
|
2024-07-24 07:16:52 +00:00
|
|
|
extraSpecialArgs = { inherit inputs lib; };
|
2024-07-21 21:19:02 +00:00
|
|
|
|
|
|
|
modules = [
|
|
|
|
../hosts/${configHost}/home.nix
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
compileHomes =
|
|
|
|
systems:
|
|
|
|
lib.right
|
|
|
|
builtins.listToAttrs
|
|
|
|
(map toPartialHomeManagerConfig)
|
|
|
|
systems;
|
2024-07-21 20:23:33 +00:00
|
|
|
}
|