2023-11-26 12:12:22 +01:00
|
|
|
{
|
|
|
|
inputs,
|
|
|
|
overlays,
|
|
|
|
}: rec {
|
2023-06-15 01:40:55 +02:00
|
|
|
hmCommonConfig = {username}: ({
|
2023-06-14 03:09:32 +02:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
2023-06-15 01:40:55 +02:00
|
|
|
}: let
|
|
|
|
homeLib = import ../home/lib.nix {inherit inputs username pkgs;};
|
|
|
|
in {
|
2023-06-14 03:09:32 +02:00
|
|
|
config = {
|
2023-06-20 21:07:44 +02:00
|
|
|
nixpkgs.overlays = overlays;
|
2023-06-14 03:09:32 +02:00
|
|
|
home-manager = {
|
|
|
|
backupFileExtension = "backup";
|
2023-06-15 01:40:55 +02:00
|
|
|
extraSpecialArgs = homeLib.extraSpecialArgs;
|
|
|
|
sharedModules = homeLib.modules;
|
2023-06-14 03:09:32 +02:00
|
|
|
useGlobalPkgs = true;
|
|
|
|
useUserPackages = true;
|
|
|
|
users.${username}.imports = [../home];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
2023-11-26 12:12:22 +01:00
|
|
|
|
2023-06-14 03:09:32 +02:00
|
|
|
mkSystem = {
|
|
|
|
host,
|
|
|
|
system,
|
|
|
|
username,
|
2023-11-28 12:21:17 +01:00
|
|
|
isGraphical ? false,
|
2023-06-14 03:09:32 +02:00
|
|
|
extraModules ? [],
|
|
|
|
}: let
|
2023-11-26 12:12:22 +01:00
|
|
|
ldTernary = l: d:
|
|
|
|
if pkgs.stdenv.isLinux
|
|
|
|
then l
|
|
|
|
else if pkgs.stdenv.isDarwin
|
|
|
|
then d
|
2023-06-24 21:24:20 +02:00
|
|
|
else throw "Unsupported system";
|
2023-11-26 12:12:22 +01:00
|
|
|
target = ldTernary "nixosConfigurations" "darwinConfigurations";
|
|
|
|
builder = with inputs; ldTernary nixpkgs.lib.nixosSystem darwin.lib.darwinSystem;
|
|
|
|
module = ldTernary "nixosModules" "darwinModules";
|
|
|
|
hostPlatform = ldTernary "linux" "darwin";
|
|
|
|
|
2023-06-14 03:09:32 +02:00
|
|
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
|
|
|
in {
|
|
|
|
${target}."${host}" = builder {
|
|
|
|
inherit system;
|
2023-06-15 01:40:55 +02:00
|
|
|
modules = with inputs;
|
2023-06-24 21:24:20 +02:00
|
|
|
[
|
|
|
|
{
|
2023-11-28 12:21:17 +01:00
|
|
|
config.lib.dotfiles = {inherit username;};
|
|
|
|
options.isGraphical = pkgs.lib.mkOption {
|
|
|
|
type = pkgs.lib.types.bool;
|
|
|
|
default = isGraphical;
|
|
|
|
description = "Whether the system is a isGraphical target";
|
|
|
|
};
|
2023-06-24 21:24:20 +02:00
|
|
|
}
|
|
|
|
./common/shared
|
|
|
|
./common/${hostPlatform}
|
|
|
|
./${host}
|
|
|
|
home-manager.${module}.home-manager
|
|
|
|
]
|
2023-06-15 01:40:55 +02:00
|
|
|
++ [(hmCommonConfig {inherit username;})]
|
2023-06-14 03:09:32 +02:00
|
|
|
++ extraModules;
|
2023-08-21 07:07:11 +02:00
|
|
|
specialArgs = {inherit inputs;};
|
2023-06-14 03:09:32 +02:00
|
|
|
};
|
|
|
|
};
|
2023-11-26 12:12:22 +01:00
|
|
|
|
2023-06-24 21:24:20 +02:00
|
|
|
mkSystems = systems: inputs.nixpkgs.lib.mkMerge (map mkSystem systems);
|
2023-06-14 03:09:32 +02:00
|
|
|
}
|