2024-11-05 08:55:25 +00:00
|
|
|
{ nixpkgs, nix-darwin, 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;
|
2024-09-12 00:34:57 +00:00
|
|
|
overlays = [
|
|
|
|
self.overlays.default
|
|
|
|
inputs.niri.overlays.niri
|
2024-11-15 16:13:21 +00:00
|
|
|
inputs.lix-module.overlays.lixFromNixpkgs
|
2024-09-12 00:34:57 +00:00
|
|
|
];
|
2024-08-19 12:55:29 +00:00
|
|
|
});
|
|
|
|
|
2024-08-22 07:17:55 +00:00
|
|
|
lib = nixpkgs.lib.extend (import ./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-22 06:48:39 +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 =
|
2024-08-22 07:03:54 +00:00
|
|
|
{ hostname, system ? "x86_64-linux" }:
|
2024-08-01 07:46:04 +00:00
|
|
|
nameValuePair
|
|
|
|
hostname
|
2024-08-22 06:26:15 +00:00
|
|
|
(nixosSystem rec {
|
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 = [
|
2024-08-22 07:17:55 +00:00
|
|
|
./hosts/${hostname}/hardware-configuration.nix
|
|
|
|
./hosts/${hostname}/configuration.nix
|
2024-07-21 20:23:33 +00:00
|
|
|
inputs.home-manager.nixosModules.default
|
2024-10-02 14:07:25 +00:00
|
|
|
inputs.chaotic.nixosModules.default
|
2024-09-12 00:34:57 +00:00
|
|
|
inputs.niri.nixosModules.niri
|
2024-08-22 06:26:15 +00:00
|
|
|
{
|
|
|
|
home-manager.extraSpecialArgs = {
|
|
|
|
inherit inputs self pkgs;
|
|
|
|
lib = pkgs.lib.extend (_: _: inputs.home-manager.lib);
|
|
|
|
};
|
|
|
|
}
|
2024-07-21 20:23:33 +00:00
|
|
|
];
|
2024-08-01 07:46:04 +00:00
|
|
|
});
|
2024-07-21 21:19:02 +00:00
|
|
|
|
|
|
|
toPartialHomeManagerConfig =
|
2024-08-22 07:03:54 +00:00
|
|
|
{ user, system ? "x86_64-linux", hostname ? "", configHostname ? "" }:
|
2024-07-21 21:19:02 +00:00
|
|
|
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 = [
|
2024-10-02 14:07:25 +00:00
|
|
|
inputs.chaotic.homeManagerModules.default
|
2024-08-22 07:17:55 +00:00
|
|
|
./hosts/${configHost}/home.nix
|
2024-07-21 21:19:02 +00:00
|
|
|
];
|
2024-08-01 07:46:04 +00:00
|
|
|
});
|
2024-11-05 08:55:25 +00:00
|
|
|
|
|
|
|
toPartialDarwinConfig =
|
|
|
|
{ hostname, system ? "aarch64-darwin", }:
|
|
|
|
nameValuePair
|
|
|
|
hostname
|
|
|
|
(nix-darwin.lib.darwinSystem rec {
|
|
|
|
pkgs = makePkgs system;
|
|
|
|
specialArgs = { inherit inputs self; };
|
|
|
|
|
|
|
|
modules = [
|
|
|
|
inputs.home-manager.darwinModules.home-manager
|
|
|
|
./hosts/${hostname}/configuration.nix
|
|
|
|
{
|
|
|
|
home-manager.extraSpecialArgs = {
|
|
|
|
inherit inputs self pkgs;
|
|
|
|
lib = pkgs.lib.extend (_: _: inputs.home-manager.lib);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2024-11-06 01:11:49 +00:00
|
|
|
compileSystems =
|
|
|
|
toPartialConfiguration:
|
2024-11-05 08:55:25 +00:00
|
|
|
systems:
|
|
|
|
lib.right
|
|
|
|
builtins.listToAttrs
|
2024-11-06 01:11:49 +00:00
|
|
|
(map toPartialConfiguration)
|
2024-11-05 08:55:25 +00:00
|
|
|
systems;
|
2024-11-06 01:11:49 +00:00
|
|
|
compileNixosSystems = compileSystems toPartialNixosConfig;
|
|
|
|
compileDarwinSystems = compileSystems toPartialDarwinConfig;
|
|
|
|
compileHomes = compileSystems toPartialHomeManagerConfig;
|
2024-07-21 20:23:33 +00:00
|
|
|
}
|