-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
236 lines (218 loc) · 6.46 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
{
description = "Your new nix config";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
# hyprland = {
# url = "github:hyprwm/Hyprland";
# };
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
sops-nix.url = "github:Mic92/sops-nix";
hardware.url = "github:nixos/nixos-hardware";
xremap-flake.url = "github:xremap/nix-flake";
dwarffs.url = "github:edolstra/dwarffs";
pfui.url = "github:b3nj5m1n/pfui";
nixos-cosmic = {
url = "github:lilyinstarlight/nixos-cosmic";
inputs.nixpkgs.follows = "nixpkgs";
};
ghostty = {
url = "github:ghostty-org/ghostty";
};
};
outputs = {
self,
fenix,
nixpkgs,
home-manager,
# hyprland,
flake-utils,
sops-nix,
dwarffs,
pfui,
nixos-cosmic,
ghostty,
...
} @ inputs: let
inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
# "i686-linux"
# "aarch64-darwin"
# "x86_64-darwin"
];
in rec {
# Custom packages
packages = forAllSystems (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./nix/pkgs {
inherit pkgs;
inherit system;
inherit fenix;
inherit pfui;
inherit ghostty;
}
);
# Devshell for bootstrapping
devShells = forAllSystems (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./nix/shell.nix {inherit pkgs;}
);
apps = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
format = flake-utils.lib.mkApp {
drv = pkgs.writeShellApplication {
name = "format";
runtimeInputs = [pkgs.alejandra];
text = ''
alejandra --check .
'';
};
};
});
# Custom packages and modifications, exported as overlays
overlays = import ./nix/overlays {
inherit inputs;
inherit fenix;
inherit pfui;
inherit ghostty;
# inherit hyprland;
};
# Reusable nixos modules you might want to export
# These are usually stuff you would upstream into nixpkgs
nixosModules = import ./nix/modules/nixos;
# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./nix/modules/home-manager;
nixosConfigurations = {
adelie = nixpkgs.lib.nixosSystem {
# I know it's Adélie
specialArgs = {inherit inputs outputs;};
modules = [
{
nix.settings = {
substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
};
}
nixos-cosmic.nixosModules.default
# dwarffs.nixosModules.dwarffs
./nix/nixos/adelie.nix
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."b3nj4m1n" = {
imports = [
./nix/home-manager/adelie.nix
];
};
}
];
};
emperor = nixpkgs.lib.nixosSystem {
# Desktop
specialArgs = {inherit inputs outputs;};
modules = [
{
nix.settings = {
substituters = [ "https://cosmic.cachix.org/" ];
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
};
}
nixos-cosmic.nixosModules.default
./nix/nixos/emperor.nix
sops-nix.nixosModules.sops
# hyprland.nixosModules.default
# {programs.hyprland.enable = true;}
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.sharedModules = [
# hyprland.homeManagerModules.default
];
home-manager.users."b3nj4m1n" = {
imports = [
./nix/home-manager/emperor.nix
];
};
}
inputs.xremap-flake.nixosModules.default
{
services.xremap = {
# userName = "b3nj4m1n";
# serviceMode = "user";
withWlroots = true;
# withSway = true;
yamlConfig = ''keymap:'';
# yamlConfig = ''
# keymap:
# - name: Test
# remap:
# C-b: { with_mark: left }
# device:
# only: '/dev/input/event10'
# '';
};
}
];
};
chinstrap = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./nix/nixos/chinstrap.nix
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users."admin" = {
imports = [
./nix/home-manager/chinstrap.nix
];
};
}
];
};
};
homeConfigurations = {
"b3nj4m1n@adelie" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./nix/home-manager/adelie.nix
];
};
"b3nj4m1n@emperor" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./nix/home-manager/emperor.nix
];
};
"admin@chinstrap" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.aarch64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./nix/home-manager/chinstrap.nix
];
};
};
};
}