2023-06-14 03:09:32 +02:00
|
|
|
{inputs}: rec {
|
2023-06-20 21:07:44 +02:00
|
|
|
overlays = [
|
|
|
|
(final: prev: {
|
|
|
|
nur = import inputs.nur {
|
|
|
|
nurpkgs = prev;
|
|
|
|
pkgs = prev;
|
|
|
|
repoOverrides = {
|
|
|
|
caarlos0 = inputs.caarlos0-nur.packages.${prev.system};
|
|
|
|
nekowinston = inputs.nekowinston-nur.packages.${prev.system};
|
|
|
|
};
|
2023-06-14 03:09:32 +02:00
|
|
|
};
|
2023-07-19 20:43:40 +02:00
|
|
|
nekowinston-nur = import inputs.nekowinston-nur {inherit (prev) pkgs;};
|
2023-07-13 09:16:08 +02:00
|
|
|
nix-vscode-extensions = inputs.nix-vscode-extensions.extensions.${prev.system};
|
2023-07-18 04:20:56 +02:00
|
|
|
sway-unwrapped = inputs.swayfx.packages.${prev.system}.default;
|
2023-06-20 21:07:44 +02:00
|
|
|
})
|
|
|
|
inputs.nekowinston-nur.overlays.default
|
|
|
|
];
|
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];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
mkSystem = {
|
|
|
|
host,
|
|
|
|
system,
|
|
|
|
username,
|
|
|
|
extraModules ? [],
|
|
|
|
}: let
|
|
|
|
target =
|
|
|
|
if isLinux
|
|
|
|
then "nixosConfigurations"
|
|
|
|
else if isDarwin
|
|
|
|
then "darwinConfigurations"
|
|
|
|
else throw "Unsupported system";
|
2023-06-15 01:40:55 +02:00
|
|
|
builder = with inputs;
|
|
|
|
if isLinux
|
|
|
|
then nixpkgs.lib.nixosSystem
|
|
|
|
else if isDarwin
|
|
|
|
then darwin.lib.darwinSystem
|
|
|
|
else throw "Unsupported system";
|
|
|
|
module =
|
2023-06-14 03:09:32 +02:00
|
|
|
if isLinux
|
2023-06-15 01:40:55 +02:00
|
|
|
then "nixosModules"
|
2023-06-14 03:09:32 +02:00
|
|
|
else if isDarwin
|
2023-06-15 01:40:55 +02:00
|
|
|
then "darwinModules"
|
2023-06-14 03:09:32 +02:00
|
|
|
else throw "Unsupported system";
|
2023-06-24 21:24:20 +02:00
|
|
|
hostPlatform =
|
|
|
|
if isLinux
|
|
|
|
then "linux"
|
|
|
|
else if isDarwin
|
|
|
|
then "darwin"
|
|
|
|
else throw "Unsupported system";
|
2023-06-14 03:09:32 +02:00
|
|
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
2023-06-15 01:40:55 +02:00
|
|
|
inherit (pkgs.stdenv) isDarwin isLinux;
|
2023-06-14 03:09:32 +02:00
|
|
|
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
|
|
|
[
|
|
|
|
{
|
|
|
|
options.dotfiles.username = with pkgs.lib;
|
|
|
|
mkOption {
|
|
|
|
description = "Main user of this configuration.";
|
|
|
|
type = types.str;
|
|
|
|
default = "${username}";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
./common/shared
|
|
|
|
./common/${hostPlatform}
|
|
|
|
./${host}
|
|
|
|
home-manager.${module}.home-manager
|
|
|
|
]
|
2023-06-16 02:35:20 +02:00
|
|
|
++ pkgs.lib.optionals isDarwin [nekowinston-nur.darwinModules.default]
|
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-06-24 21:24:20 +02:00
|
|
|
mkSystems = systems: inputs.nixpkgs.lib.mkMerge (map mkSystem systems);
|
2023-06-14 03:09:32 +02:00
|
|
|
}
|