-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
254 lines (227 loc) · 8.32 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
{
description = "Tom Doggett's Nix-Config";
inputs = {
#################### Official NixOS and HM Package Sources ####################
#nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05"; # also see 'stable-packages' overlay at 'overlays/default.nix"
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; # also see 'unstable-packages' overlay at 'overlays/default.nix"
impermanence.url = "github:nix-community/impermanence";
hardware.url = "github:nixos/nixos-hardware";
#home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
#################### Utilities ####################
# Declarative partitioning and formatting
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
# Styling for Visual Applications
stylix.url = "github:danth/stylix";
# Secrets management
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
# Pre-commit hooks
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# Cosmis Desktop Environment
nixos-cosmic.url = "github:lilyinstarlight/nixos-cosmic";
nixos-cosmic.inputs.nixpkgs.follows = "nixpkgs-unstable";
# Plasma Manager
plasma-manager.url = "github:nix-community/plasma-manager";
plasma-manager.inputs.nixpkgs.follows = "nixpkgs";
plasma-manager.inputs.home-manager.follows = "home-manager";
# Hyprland
hyprland.url = "github:hyprwm/Hyprland";
split-monitor-workspaces.url = "github:Duckonaut/split-monitor-workspaces";
split-monitor-workspaces.inputs.hyprland.follows = "hyprland"; # <- make sure this line is present for the plugin to work as intended
# Disposable email list
disposable-email-domains.url = "github:disposable-email-domains/disposable-email-domains";
disposable-email-domains.flake = false;
#################### Personal Repositories ####################
# Private secrets repo
# Authenticate via ssh and use shallow clone
nix-secrets.url = "git+ssh://[email protected]/nocoolnametom/nix-secrets.git?ref=main&shallow=1";
nix-secrets.inputs = { };
};
outputs =
{
self,
nixpkgs,
impermanence,
hardware,
home-manager,
nix-darwin,
disko,
stylix,
sops-nix,
nixos-cosmic,
plasma-manager,
split-monitor-workspaces,
disposable-email-domains,
nix-secrets,
...
}@inputs:
let
inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux" # Most other systems
"aarch64-linux" # Raspberry Pi 4
"aarch64-darwin" # Apple Silicon
];
inherit (nixpkgs) lib;
configVars = import ./vars { inherit inputs lib; };
configLib = import ./lib { inherit lib; };
configurationRevision = self.rev or self.dirtyRev or null;
specialArgs = {
inherit
inputs
outputs
configVars
configLib
nixpkgs
configurationRevision
;
};
in
{
# Custom modules to enable special functionality for nixos or home-manager oriented configs.
nixosModules = import ./modules/nixos;
darwinModules = import ./modules/darwin;
homeManagerModules = import ./modules/home-manager;
# Custom modifications/overrides to upstream packages.
overlays = import ./overlays { inherit inputs outputs; };
# Custom packages to be shared or upstreamed.
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./pkgs { inherit pkgs; }
);
checks = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./checks { inherit inputs system pkgs; }
);
# Nix formatter available through 'nix fmt' https://github.com/NixOS/nixfmt
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
# Shell configured with packages that are typically only needed when working on or with nix-config.
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./shell.nix { inherit pkgs; }
);
#################### NixOS Configurations ####################
#
# Building configurations available through `nixos-rebuild --flake .#hostname`
#
# You can dry-run any machine's config on another machine with the flake already in `/etc/nixos`
# via `nixos-rebuild dry-build --flake .#hostname`
nixosConfigurations =
let
# Use this with the nixos-cosmic nixos modules to enable the cosmic desktop environment.
cosmicCacheModule = {
nix.settings = {
substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
};
};
in
{
# System76 Pangolin 11 AMD Laptop
pangolin11 = lib.nixosSystem {
inherit specialArgs;
modules = [
cosmicCacheModule
nixos-cosmic.nixosModules.default
home-manager.nixosModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; }
./hosts/pangolin11
];
};
# Thinkpad X1 Carbon Laptop
thinkpadx1 = lib.nixosSystem {
inherit specialArgs;
modules = [
home-manager.nixosModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; }
./hosts/thinkpadx1
];
};
# Asus Zenbook 13 Laptop
melian = lib.nixosSystem {
inherit specialArgs;
modules = [
home-manager.nixosModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; }
./hosts/melian
];
};
# Raspberry Pi 4
bert = lib.nixosSystem {
inherit specialArgs;
modules = [
home-manager.nixosModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; }
./hosts/bert
];
};
# Linode 4GB VPS
glorfindel = lib.nixosSystem {
inherit specialArgs;
modules = [
home-manager.nixosModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; }
./hosts/glorfindel
];
};
# Linode 4GB VPS
bombadil = lib.nixosSystem {
inherit specialArgs;
modules = [
home-manager.nixosModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; }
./hosts/bombadil
];
};
};
#################### Nix-Darwin Configurations ####################
#
# Building configurations available through `darwin-rebuild --flake ~/.config/nix-darwin#hostname`
#
darwinConfigurations = {
# Apple Macbook Pro 16 2003
"${nix-secrets.networking.work.macbookpro.name}" = nix-darwin.lib.darwinSystem {
inherit specialArgs;
modules = [
home-manager.darwinModules.home-manager
{ home-manager.extraSpecialArgs = specialArgs; }
./hosts/work/macbookpro
];
};
};
#################### HM-Only Configurations ####################
#
# Building configurations available through `home-manager switch --flake ~/.config/home-manager#user@hostname`
#
homeConfigurations = {
# Ubuntu VM 1
"${configVars.username}@${nix-secrets.networking.work.vm1.name}" =
home-manager.lib.homeManagerConfiguration
{
inherit specialArgs;
modules = [
./home/tdoggett/vm1
];
};
};
};
}