chore: slight flake.nix refactor
This commit is contained in:
parent
56e6ec5d8a
commit
4b3d875cb4
1 changed files with 39 additions and 21 deletions
60
flake.nix
60
flake.nix
|
@ -52,50 +52,68 @@
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
specialArgs = {
|
specialArgsCommon = {
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
abs = path: ./. + ("/" + path);
|
abs = path: ./. + ("/" + path);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkDarwinSystem = {
|
||||||
|
modules ? [],
|
||||||
|
specialArgs ? {},
|
||||||
|
}: let
|
||||||
|
specialArgsMerged = specialArgsCommon // specialArgs;
|
||||||
|
in nix-darwin.lib.darwinSystem {
|
||||||
|
modules = [
|
||||||
|
agenix.darwinModules.default
|
||||||
|
home-manager.darwinModules.home-manager
|
||||||
|
{ home-manager.extraSpecialArgs = specialArgsMerged; }
|
||||||
|
] ++ modules;
|
||||||
|
specialArgs = specialArgsMerged;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkNixosSystem = {
|
||||||
|
system,
|
||||||
|
modules ? [],
|
||||||
|
specialArgs ? {}
|
||||||
|
}: let
|
||||||
|
specialArgsMerged = specialArgsCommon // specialArgs // {
|
||||||
|
pkgs-stable = import nixpkgs-stable {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
config = { allowUnfree = true; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
agenix.nixosModules.default
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{ home-manager.extraSpecialArgs = specialArgsMerged; }
|
||||||
|
] ++ modules;
|
||||||
|
specialArgs = specialArgsMerged;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
koi = nixpkgs.lib.nixosSystem {
|
koi = mkNixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
agenix.nixosModules.default
|
|
||||||
bootspec-secureboot.nixosModules.bootspec-secureboot
|
bootspec-secureboot.nixosModules.bootspec-secureboot
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
{ home-manager.extraSpecialArgs = specialArgs; }
|
|
||||||
./hosts/koi/configuration.nix
|
./hosts/koi/configuration.nix
|
||||||
];
|
];
|
||||||
specialArgs = specialArgs // {
|
|
||||||
pkgs-stable = import nixpkgs-stable {
|
|
||||||
system = "x86_64-linux";
|
|
||||||
config = { allowUnfree = true; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
darwinConfigurations = {
|
darwinConfigurations = {
|
||||||
teidesu-osx = nix-darwin.lib.darwinSystem {
|
teidesu-osx = mkDarwinSystem {
|
||||||
modules = [
|
modules = [
|
||||||
agenix.darwinModules.default
|
|
||||||
home-manager.darwinModules.home-manager
|
|
||||||
{ home-manager.extraSpecialArgs = specialArgs; }
|
|
||||||
./hosts/teidesu-osx/configuration.nix
|
./hosts/teidesu-osx/configuration.nix
|
||||||
];
|
];
|
||||||
inherit specialArgs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
airi = nix-darwin.lib.darwinSystem {
|
airi = mkDarwinSystem {
|
||||||
modules = [
|
modules = [
|
||||||
agenix.darwinModules.default
|
|
||||||
home-manager.darwinModules.home-manager
|
|
||||||
{ home-manager.extraSpecialArgs = specialArgs; }
|
|
||||||
./hosts/airi/configuration.nix
|
./hosts/airi/configuration.nix
|
||||||
];
|
];
|
||||||
inherit specialArgs;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue