blob: ac0a88a69f2c34be242fa5445eee0d5ad5464f39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
{ inputs, ... }:
let
lib = inputs.nixpkgs.lib;
isDarwin = s: lib.strings.hasSuffix "-darwin" s;
in rec {
mkSystem =
{ host
, username
, system
, extraModules ? [ ]
, extraArguments ? { }
}:
let
darwinHost = isDarwin system;
builder = if darwinHost
then inputs.nix-darwin.lib.darwinSystem
else inputs.nixpkgs.lib.nixosSystem;
hmModule = if darwinHost
then inputs.home-manager.darwinModules.home-manager
else inputs.home-manager.nixosModules.home-manager;
hostDir = ../hosts/${host};
hostCfg = hostDir + "/configuration.nix";
hostHome = hostDir + "/home.nix";
modules =
[ hostCfg ]
++ (lib.optional darwinHost inputs."mac-app-util".darwinModules.default)
++ [
hmModule {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.${username} = import hostHome;
}
]
++ extraModules;
in
builder {
inherit system modules;
specialArgs = { inherit inputs username; } // extraArguments;
};
}
|