-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
151 lines (139 loc) · 4.02 KB
/
flake.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
{
inputs = {
nixpkgs_23_05.url = "github:NixOS/nixpkgs/nixos-23.05";
nixpkgs_unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager_23_05 = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs_23_05";
};
emacs_23_07_09 = {
url = "github:nix-community/emacs-overlay/2a779188014aad4cfc73860c97121d9707259e2a";
inputs.nixpkgs.follows = "nixpkgs_23_05";
};
nur.url = "github:nix-community/NUR";
flakez.url = "github:aruZeta/flakez";
# Mac
nixpkgs-darwin_23_05.url = "github:NixOS/nixpkgs/nixpkgs-23.05-darwin";
nixpkgs-darwin_unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
darwin = {
url = "github:LnL7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs-darwin_unstable";
};
home-manager-darwin = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs-darwin_unstable";
};
};
outputs =
{ self
, nixpkgs_23_05
, nixpkgs_unstable
, home-manager_23_05
, nur
, flakez
, nixpkgs-darwin_23_05
, nixpkgs-darwin_unstable
, darwin
, home-manager-darwin
, ...
} @ inputs:
let
noAllowDirty =
if self ? rev
then self.rev
else throw "Refusing to build from a dirty Git tree!";
domain = "machine.aruzeta.com";
hosts = {
mainLaptop = {
name = "main-laptop";
system = "x86_64-linux";
};
work.kairos.mac = {
name = "work-kairos-mac";
system = "aarch64-darwin";
};
};
apply = host: modules:
let
conf = {
system = host.system;
modules = (modules host) ++ [
# Set hostname and domain
(networking host)
# Don't allow dirty git trees
{ system.configurationRevision = noAllowDirty; }
];
};
in {
${host.name} = nixpkgs_23_05.lib.nixosSystem conf;
};
applyDarwin = host: extra: modules:
let
user = extra.user;
conf = {
system = host.system;
specialArgs = inputs // {
inherit user;
};
modules = (modules host user) ++ [
# Don't allow dirty git trees
{ system.configurationRevision = noAllowDirty; }
];
};
in {
${host.name} = darwin.lib.darwinSystem conf;
};
networking = host:
{ networking = {
hostName = host.name;
domain = domain;
};
};
in {
nixosConfigurations = {
} // (apply hosts.mainLaptop (host: [
# Hardware
./hardware/msi-bravo-15-b5dd.nix
# Config
./users/aru/system/default.nix
# Home manager
home-manager_23_05.nixosModules.home-manager
# Home manager config
{
home-manager.useGlobalPkgs = false;
home-manager.useUserPackages = true;
home-manager.users.aru = import ./home/aru.nix;
home-manager.extraSpecialArgs = inputs // {
pkgsUnstable = config: import nixpkgs_unstable {
system = host.system;
inherit config;
};
};
}
]));
darwinConfigurations = {
} // (applyDarwin hosts.work.kairos.mac {
user = rec {
name = "aru";
home = "/Users/${name}";
};
} (host: user: [
# Config
./users/work-kairos-mac/system
# Home manager
home-manager-darwin.darwinModules.home-manager
# Home manager config
{
home-manager.useGlobalPkgs = true;
home-manager.users.aru = import ./home/work-kairos-mac.nix;
home-manager.extraSpecialArgs = inputs // {
pkgsUnstable = config: import nixpkgs-darwin_unstable {
system = host.system;
inherit config;
};
inherit user;
};
}
]));
};
}