-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
211 lines (188 loc) · 5.85 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
{
description = "My Machines";
# miraculix
# nix --experimental-features "nix-command flakes" build ".#darwinConfigurations.miraculix.system"
# ./result/sw/bin/darwin-rebuild switch --flake ~/.nixpkgs
# obelix
# nix --experimental-features "nix-command flakes" build ".#nixosConfigurations.obelix.config.system.build.toplevel"
# ./result/bin/switch-to-configuration switch
# or if you want to edit boot entry
# sudo nixos-rebuild switch --flake ".#obelix"
# or if you want to install from scratch
# sudo nixos-install --flake github:reiferschris/dotfiles#obelix
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
forgit = {
url = "github:wfxr/forgit";
flake = false;
};
};
outputs = { self, nixpkgs, darwin, home-manager, disko, ... }@inputs:
let
nixpkgsConfig = {
allowUnfree = true;
allowUnsupportedSystem = false;
};
overlays = with inputs; [
# feovim.overlay
# krewfile.overlay
];
stateVersion = "22.05";
user = "chris";
in
{
# macbook air m1 work
# nix-darwin with home-manager for macOS
darwinConfigurations.miraculix = darwin.lib.darwinSystem {
system = "aarch64-darwin";
# makes all inputs availble in imported files
specialArgs = { inherit inputs; };
modules = [
./modules
./machines/miraculix.nix
./darwin/homebrew.nix
({ pkgs, ... }: {
nixpkgs.config = nixpkgsConfig;
nixpkgs.overlays = overlays;
system.stateVersion = 4;
users.users.${user} = {
home = "/Users/${user}";
shell = pkgs.zsh;
};
nix = {
# enable flakes per default
package = pkgs.nixFlakes;
settings = {
allowed-users = [ user ];
experimental-features = [ "nix-command" "flakes" ];
};
};
})
home-manager.darwinModule
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
# makes all inputs available in imported files for hm
extraSpecialArgs = { inherit inputs; };
users.${user} = { ... }: {
imports = [
./home/mac.nix
./darwin
./shell
./desktop/wezterm.nix
];
home.stateVersion = stateVersion;
};
};
}
];
};
# macbook 13 inch
# nix-darwin with home-manager for macOS
darwinConfigurations.idefix = darwin.lib.darwinSystem {
system = "x86_64-darwin";
# makes all inputs availble in imported files
specialArgs = { inherit inputs; };
modules = [
./modules
./machines/idefix.nix
./darwin/homebrew.nix
({ pkgs, ... }: {
nixpkgs.config = nixpkgsConfig;
nixpkgs.overlays = overlays;
system.stateVersion = 4;
users.users.${user} = {
home = "/Users/${user}";
shell = pkgs.zsh;
};
nix = {
# enable flakes per default
package = pkgs.nixFlakes;
settings = {
allowed-users = [ user ];
experimental-features = [ "nix-command" "flakes" ];
};
};
})
home-manager.darwinModule
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
# makes all inputs available in imported files for hm
extraSpecialArgs = { inherit inputs; };
users.${user} = { ... }: {
imports = [
./home/mac.nix
./darwin
./shell
./desktop/wezterm.nix
];
home.stateVersion = stateVersion;
};
};
}
];
};
# nixos system
nixosConfigurations.obelix = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
# makes all inputs availble in imported files
specialArgs = { inherit inputs; inherit user; };
modules = [
./modules
./machines/obelix.nix
./system
disko.nixosModules.disko
({ pkgs, ... }: {
nixpkgs.config = nixpkgsConfig;
nixpkgs.overlays = overlays;
system.stateVersion = stateVersion;
users.users.${user} = {
home = "/home/${user}";
shell = pkgs.zsh;
isNormalUser = true;
};
nix = {
# enable flakes per default
package = pkgs.nixFlakes;
settings = {
allowed-users = [ user ];
experimental-features = [ "nix-command" "flakes" ];
};
};
})
home-manager.nixosModule
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
# makes all inputs available in imported files for hm
extraSpecialArgs = { inherit inputs; };
users.${user} = { ... }: {
imports = [
./home/linux.nix
./shell
./desktop
];
home.stateVersion = stateVersion;
};
};
}
];
};
};
}