2024-08-10 18:02:58 +00:00
|
|
|
{ nixpkgs, self, ... }@inputs:
|
2024-07-21 20:23:33 +00:00
|
|
|
|
|
|
|
let
|
2024-08-19 12:55:29 +00:00
|
|
|
makePkgs = system: (import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
|
|
|
|
config.allowUnfree = true;
|
|
|
|
overlays = [ self.overlays.default ];
|
|
|
|
});
|
|
|
|
|
2024-08-19 13:50:35 +00:00
|
|
|
lib = nixpkgs.lib;
|
2024-08-19 13:21:38 +00:00
|
|
|
|
2024-08-01 07:46:04 +00:00
|
|
|
inherit (inputs.home-manager.lib) homeManagerConfiguration;
|
2024-08-19 13:21:38 +00:00
|
|
|
inherit (lib) nixosSystem;
|
2024-08-01 07:46:04 +00:00
|
|
|
inherit (lib.strings) optionalString;
|
|
|
|
inherit (lib.attrsets) nameValuePair;
|
2024-07-21 20:23:33 +00:00
|
|
|
in
|
|
|
|
rec {
|
|
|
|
toPartialNixosConfig =
|
|
|
|
{ hostname, system }:
|
2024-08-01 07:46:04 +00:00
|
|
|
nameValuePair
|
|
|
|
hostname
|
|
|
|
(nixosSystem {
|
2024-08-19 12:55:29 +00:00
|
|
|
pkgs = makePkgs system;
|
2024-08-19 13:21:38 +00:00
|
|
|
specialArgs = { inherit inputs self; };
|
2024-08-19 12:55:29 +00:00
|
|
|
|
2024-07-21 20:23:33 +00:00
|
|
|
modules = [
|
|
|
|
../hosts/${hostname}/hardware-configuration.nix
|
|
|
|
../hosts/${hostname}/configuration.nix
|
|
|
|
inputs.home-manager.nixosModules.default
|
|
|
|
];
|
2024-08-01 07:46:04 +00:00
|
|
|
});
|
2024-07-21 20:23:33 +00:00
|
|
|
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;
|
2024-08-01 07:46:04 +00:00
|
|
|
hostStr = optionalString (builtins.stringLength hostname > 0) "@${hostname}";
|
2024-07-21 21:19:02 +00:00
|
|
|
in
|
2024-07-22 07:05:45 +00:00
|
|
|
assert lib.assertMsg (builtins.stringLength configHost > 0) "either configHostname or hostname need to exist";
|
2024-08-01 07:46:04 +00:00
|
|
|
nameValuePair
|
|
|
|
"${user}${hostStr}"
|
|
|
|
(homeManagerConfiguration {
|
2024-08-19 12:55:29 +00:00
|
|
|
pkgs = makePkgs system;
|
2024-08-19 13:21:38 +00:00
|
|
|
extraSpecialArgs = { inherit inputs self; };
|
2024-07-21 21:19:02 +00:00
|
|
|
|
|
|
|
modules = [
|
|
|
|
../hosts/${configHost}/home.nix
|
|
|
|
];
|
2024-08-01 07:46:04 +00:00
|
|
|
});
|
2024-07-21 21:19:02 +00:00
|
|
|
compileHomes =
|
|
|
|
systems:
|
|
|
|
lib.right
|
|
|
|
builtins.listToAttrs
|
|
|
|
(map toPartialHomeManagerConfig)
|
|
|
|
systems;
|
2024-07-21 20:23:33 +00:00
|
|
|
}
|