-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
217 lines (191 loc) · 6.55 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
{
description = "Satellite";
# {{{ Inputs
inputs = {
# {{{ Nixpkgs instances
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# }}}
# {{{ Additional package repositories
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# Firefox addons
firefox-addons.url = "git+https://gitlab.com/rycee/nur-expressions?dir=pkgs/firefox-addons";
firefox-addons.inputs.nixpkgs.follows = "nixpkgs";
# }}}
# {{{ Nix-related tooling
# {{{ Storage
impermanence.url = "github:nix-community/impermanence";
# Declarative partitioning
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
# }}}
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.url = "github:Mic92/nix-index-database";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
korora.url = "github:adisbladis/korora";
# }}}
# {{{ Standalone software
# {{{ Nightly versions of things
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs";
# }}}
# {{{ Self management
# Smos
smos.url = "github:NorfairKing/smos";
# smos.inputs.nixpkgs.url = "github:NixOS/nixpkgs/b8dd8be3c790215716e7c12b247f45ca525867e2";
# Intray
intray.url = "github:NorfairKing/intray";
# intray.inputs.nixpkgs.url = "github:NixOS/nixpkgs/fc07dc3bdf2956ddd64f24612ea7fc894933eb2e";
# }}}
anyrun.url = "github:Kirottu/anyrun";
anyrun.inputs.nixpkgs.follows = "nixpkgs";
miros.url = "github:prescientmoon/miros";
miros.inputs.nixpkgs.follows = "nixpkgs";
# Spotify client with theming support
spicetify-nix.url = "github:Gerg-L/spicetify-nix";
spicetify-nix.inputs.nixpkgs.follows = "nixpkgs";
# }}}
# {{{ Theming
darkmatter-grub-theme.url = "gitlab:VandalByte/darkmatter-grub-theme";
darkmatter-grub-theme.inputs.nixpkgs.follows = "nixpkgs";
stylix.url = "github:danth/stylix/a33d88cf8f75446f166f2ff4f810a389feed2d56";
# stylix.inputs.nixpkgs.follows = "nixpkgs";
# stylix.inputs.home-manager.follows = "home-manager";
base16-schemes.url = "github:tinted-theming/schemes";
base16-schemes.flake = false;
# }}}
};
# }}}
outputs =
{
self,
nixpkgs,
home-manager,
...
}@inputs:
let
# {{{ Common helpers
inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ];
specialArgs = system: {
inherit inputs outputs;
upkgs = inputs.nixpkgs-unstable.legacyPackages.${system};
};
in
# }}}
{
# {{{ Packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
upkgs = inputs.nixpkgs-unstable.legacyPackages.${system};
myPkgs = import ./pkgs { inherit pkgs upkgs; };
in
myPkgs
// (import ./dns/implementation) {
inherit pkgs;
extraModules = [ ./dns/config/common.nix ];
octodnsConfig = ./dns/config/octodns.yaml;
nixosConfigurations = builtins.removeAttrs self.nixosConfigurations [ "iso" ];
}
);
# }}}
# {{{ Bootstrapping and other pinned devshells
# Accessible through 'nix develop'
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
args = {
inherit pkgs;
} // specialArgs system;
in
import ./devshells args
);
# }}}
# {{{ Overlays and modules
# Custom packages and modifications, exported as overlays
overlays = import ./overlays;
# Reusable nixos modules
nixosModules = import ./modules/nixos // import ./modules/common;
# Reusable home-manager modules
homeManagerModules = import ./modules/home-manager // import ./modules/common;
# }}}
# {{{ Nixos
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#...
nixosConfigurations =
let
nixos =
{ system, hostname }:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = specialArgs system;
modules = [
# {{{ Import home manager
(
{ lib, ... }:
{
imports = lib.lists.optionals (builtins.pathExists ./home/${hostname}.nix) [
home-manager.nixosModules.home-manager
{
home-manager.users.pilot = ./home/${hostname}.nix;
home-manager.extraSpecialArgs = specialArgs system // {
inherit hostname;
};
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "hm-backup";
stylix.homeManagerIntegration.followSystem = false;
stylix.homeManagerIntegration.autoImport = false;
}
];
}
)
# }}}
./hosts/nixos/${hostname}
];
};
in
{
tethys = nixos {
system = "x86_64-linux";
hostname = "tethys";
};
lapetus = nixos {
system = "x86_64-linux";
hostname = "lapetus";
};
calypso = nixos {
system = "x86_64-linux";
hostname = "calypso";
};
iso = nixos {
system = "x86_64-linux";
hostname = "iso";
};
};
# }}}
};
# {{{ Caching and whatnot
# TODO: persist trusted substituters file
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
# "https://anyrun.cachix.org"
"https://smos.cachix.org"
"https://intray.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
# "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
"smos.cachix.org-1:YOs/tLEliRoyhx7PnNw36cw2Zvbw5R0ASZaUlpUv+yM="
"intray.cachix.org-1:qD7I/NQLia2iy6cbzZvFuvn09iuL4AkTmHvjxrQlccQ="
];
};
# }}}
}