-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.nix
51 lines (46 loc) · 1.79 KB
/
lib.nix
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
44
45
46
47
48
49
50
51
{ inputs, outputs, stateVersion, theme }:
let
pkgsFor = platform: outputs.legacyPackages.${platform};
specialArgsFor = hostname: { inherit inputs outputs stateVersion hostname theme; };
in
with inputs.nixpkgs.lib;
with inputs.nix-darwin.lib;
with inputs.home-manager.lib;
rec {
packagesFrom = module: { system }: module.packages.${system};
defaultPackageFrom = module: attrs @ { system }: (packagesFrom module attrs // { inherit system; }).default;
mkNixosHost = { hostname, platform ? "x86_64-linux" }:
nixosSystem {
pkgs = pkgsFor platform;
specialArgs = specialArgsFor hostname;
modules = with inputs; [
base16.nixosModule
disko.nixosModules.disko
impermanence.nixosModules.impermanence
home-manager.nixosModules.default
juvian.nixosModules.default
./modules/nixos/console.nix
./modules/nixos/nix-settings.nix
(if hostname == "nixos-installer" then ./hosts/nixos/nixos-installer.nix else ./modules/nixos/system.nix)
(if hostname == "nixos-installer" then ./hosts/nixos/nixos-installer.nix else ./hosts/nixos/${hostname})
(if hostname == "nixos-installer" then ./hosts/nixos/nixos-installer.nix else ./modules/nixos)
{
scheme = "${inputs.tt-schemes}/base16/solarized-${theme}.yaml";
home-manager.extraSpecialArgs = specialArgsFor hostname;
}
];
};
mkDarwinHost = { hostname, platform ? "x86_64-darwin" }:
darwinSystem {
pkgs = pkgsFor platform;
specialArgs = specialArgsFor hostname;
modules = [
./hosts/darwin/${hostname}.nix
./modules/darwin
{
scheme = "${inputs.tt-schemes}/base16/solarized-${theme}.yaml";
home-manager.extraSpecialArgs = specialArgsFor hostname;
}
];
};
}