-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
189 lines (174 loc) · 5.16 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
{
description = "Home Manager configuration of samir";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
solc = {
url = "github:hellwolf/solc.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
foundry.url = "github:shazow/foundry.nix/monthly";
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
nur.url = "github:nix-community/NUR";
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
walker.url = "github:abenz1267/walker";
};
outputs = {
nixpkgs,
darwin,
home-manager,
...
} @ inputs: let
stateVersion = "24.05";
user = "samir";
homeDirectory = "/home/${user}";
nixConfig = {username ? user, ...}: {
allowed-users = [username];
trusted-users = ["root" username];
experimental-features = ["nix-command" "flakes"];
auto-optimise-store = false; # this breaks on macos
};
overlays = with inputs; [
neovim-nightly-overlay.overlays.default
nur.overlay
foundry.overlay
solc.overlay
];
mkCustomArgs = pkgs: {
customArgs = {
font = {
name = "JetBrainsMono Nerd Font Mono";
size =
if pkgs.stdenv.isDarwin
then 14
else 10;
};
};
};
in {
darwinConfigurations = {
work = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = {inherit inputs;};
modules = [
./machines/mbp.nix
./darwin/homebrew.nix
./darwin/work.nix
({
lib,
pkgs,
...
}: {
nixpkgs.config.allowUnfree = lib.mkDefault true;
nixpkgs.overlays = overlays;
system.stateVersion = 5;
ids.uids.nixbld = 350; # TODO: fix until update to sequoia
users.users."s.ettali" = {
home = "/Users/s.ettali";
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJJdetGPFJw+CH6wNU4BinYePWVypM42s9WI0XPodihl samir"
];
};
nix = {
package = pkgs.nixVersions.stable;
settings = nixConfig {username = "s.ettali";};
};
})
home-manager.darwinModule
({pkgs, ...}: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
# makes all inputs available in imported files for hm
extraSpecialArgs = {
inherit inputs;
inherit (mkCustomArgs pkgs) customArgs;
};
users."s.ettali" = {...}: {
imports = [
./home
./home/mac.nix
./home/packages/desktop
./home/packages/work.nix
./home/packages/dev.nix
];
home.stateVersion = stateVersion;
home.homeDirectory = "/Users/s.ettali";
home.username = "s.ettali";
};
};
})
];
};
};
nixosConfigurations = {
xps = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
inherit user;
};
modules = [
./machines/xps/configuration.nix
./machines/xps/hardware-configuration.nix
({
lib,
pkgs,
...
}: {
nixpkgs.config.allowUnfree = lib.mkDefault true;
nixpkgs.overlays = overlays;
system.stateVersion = "unstable";
users.users.${user} = {
home = homeDirectory;
shell = pkgs.zsh;
isNormalUser = true;
};
nix = {
package = pkgs.nixVersions.stable;
settings = nixConfig {};
optimise.automatic = true;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
})
home-manager.nixosModule
({pkgs, ...}: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
inherit (mkCustomArgs pkgs) customArgs;
};
users.${user} = {...}: {
imports = [
./home
./home/linux
./home/linux/desktop
./home/packages/desktop
./home/packages/dev.nix
./home/packages/security.nix
];
home.stateVersion = stateVersion;
home.homeDirectory = homeDirectory;
home.username = user;
};
};
})
];
};
};
};
}