-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
208 lines (183 loc) · 6.13 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
# flake.nix
#
# Author: Edmund Miller <[email protected]>
# URL: https://github.com/emiller88/dotfiles
# License: MIT
#
# Welcome to ground zero. Where the whole flake gets set up and all its modules
# are loaded.
{
description = "A grossly incandescent nixos config.";
inputs = {
# Core dependencies.
# Two inputs so I can track them separately at different rates.
nixpkgs.url = "nixpkgs/nixos-24.05"; # primary nixpkgs
nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; # for packages on the edge
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nur.url = "github:nix-community/NUR";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
# Utils
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
# NOTE https://github.com/danth/stylix/issues/359
stylix.url = "github:danth/stylix/release-24.05";
stylix.inputs.nixpkgs.follows = "nixpkgs";
stylix.inputs.home-manager.follows = "home-manager";
treefmt-nix.url = "github:numtide/treefmt-nix";
# Extras
emacs-overlay.url = "github:nix-community/emacs-overlay";
nixvim.url = "github:nix-community/nixvim/nixos-24.05";
nixvim.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:nixos/nixos-hardware";
ghostty.url = "git+ssh://[email protected]/ghostty-org/ghostty";
wezterm.url = "github:wez/wezterm?dir=nix";
wezterm.inputs.nixpkgs.follows = "nixpkgs";
"op-shell-plugins".url = "github:1Password/shell-plugins";
llm-prompt.url = "github:aldoborrero/llm-prompt";
llm-prompt.inputs.nixpkgs.follows = "nixpkgs";
zen-browser.url = "github:MarceColl/zen-browser-flake";
};
outputs =
inputs@{
self,
nixpkgs,
nixpkgs-unstable,
flake-parts,
nix-darwin,
...
}:
let
inherit (lib.my) mapModules mapModulesRec mapHosts;
system = "x86_64-linux";
darwinSystem = "aarch64-darwin"; # or x86_64-darwin for Intel Macs
mkPkgs =
pkgs: extraOverlays:
import pkgs {
inherit system;
config.allowUnfree = true; # forgive me Stallman senpai
overlays = extraOverlays ++ (lib.attrValues self.overlays);
};
pkgs = mkPkgs nixpkgs [ self.overlay ];
pkgs' = mkPkgs nixpkgs-unstable [ ];
lib = nixpkgs.lib.extend (
self: _super: {
my = import ./lib {
inherit pkgs inputs;
lib = self;
};
}
);
in
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.treefmt-nix.flakeModule ];
flake = {
lib = lib.my;
overlay = _final: _prev: {
unstable = pkgs';
my = self.packages."${system}";
};
overlays = mapModules ./overlays import;
packages."${system}" = mapModules ./packages (p: pkgs.callPackage p { });
nixosModules = {
dotfiles = import ./.;
} // mapModulesRec ./modules import;
nixosConfigurations = mapHosts ./hosts { };
templates = {
full = {
path = ./.;
description = "A grossly incandescent nixos config";
};
minimal = {
path = ./templates/minimal;
description = "A grossly incandescent and minimal nixos config";
};
default = self.templates.minimal;
};
apps."${system}".default = {
type = "app";
program = ./bin/hey;
};
# Add Darwin configuration
darwinConfigurations."MacTraitor-Pro" = nix-darwin.lib.darwinSystem {
system = darwinSystem;
specialArgs = {
inherit inputs lib;
};
modules = [
# Define module options first
{
options.modules = lib.mkOption {
type = lib.types.attrs;
default = { };
description = "Modules configuration options";
};
}
# Import your module system
./hosts/mactraitorpro/default.nix
# Add home-manager module
inputs.home-manager.darwinModules.home-manager
# Basic Darwin settings
{
services.nix-daemon.enable = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
system.stateVersion = 4;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
};
darwinConfigurations."Seqeratop" = nix-darwin.lib.darwinSystem {
system = darwinSystem;
specialArgs = {
inherit inputs lib;
};
modules = [
# Define module options first
{
options.modules = lib.mkOption {
type = lib.types.attrs;
default = { };
description = "Modules configuration options";
};
}
# Import your module system
./hosts/seqeratop/default.nix
# Add home-manager module
inputs.home-manager.darwinModules.home-manager
# Basic Darwin settings
{
services.nix-daemon.enable = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
system.stateVersion = 4;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
};
};
systems = [
"x86_64-linux"
"aarch64-darwin"
];
perSystem = _: {
treefmt = {
projectRootFile = ".git/config";
programs.deadnix.enable = true;
programs.nixfmt.enable = true;
programs.prettier.enable = true;
programs.statix.enable = true;
};
};
};
}