2023-02-03 05:37:18 +00:00
|
|
|
{
|
|
|
|
withSystem,
|
|
|
|
lib,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}: {
|
2023-02-11 14:14:51 +00:00
|
|
|
flake = withSystem "x86_64-linux" ({
|
|
|
|
self',
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2023-02-03 05:37:18 +00:00
|
|
|
flattenAttrs = attrs:
|
|
|
|
lib.listToAttrs (lib.flatten (lib.mapAttrsToList
|
|
|
|
(
|
|
|
|
outer_key:
|
|
|
|
lib.mapAttrsToList
|
|
|
|
(inner_key: value: {
|
|
|
|
name = "${outer_key}-${inner_key}";
|
|
|
|
inherit value;
|
|
|
|
})
|
|
|
|
)
|
|
|
|
attrs));
|
|
|
|
machines = import ./machines.nix;
|
|
|
|
buildHomeManager = config: (inputs.home-manager.lib.homeManagerConfiguration {
|
|
|
|
inherit pkgs;
|
|
|
|
modules = [
|
|
|
|
config
|
2023-02-04 00:43:09 +00:00
|
|
|
inputs.emanote.homeManagerModule
|
2023-02-03 05:37:18 +00:00
|
|
|
];
|
|
|
|
});
|
|
|
|
buildModesForHost = host: modes:
|
2023-02-11 14:14:51 +00:00
|
|
|
pkgs.recursiveLinkFarm "${host}-modes"
|
|
|
|
(lib.mapAttrs
|
|
|
|
(_: config: (buildHomeManager config).activationPackage)
|
|
|
|
modes);
|
2023-02-03 05:37:18 +00:00
|
|
|
in {
|
|
|
|
homeConfigurations = lib.mapAttrs (_: buildHomeManager) (flattenAttrs machines);
|
|
|
|
homeModes = lib.mapAttrs buildModesForHost machines;
|
|
|
|
});
|
|
|
|
}
|