-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
211 lines (198 loc) · 5.92 KB
/
Copy pathflake.nix
File metadata and controls
211 lines (198 loc) · 5.92 KB
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
{
description = "myme's NixOS configuration with flakes";
inputs = {
# NixOS + Nixpkgs
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-26.05";
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixos-wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:nix-darwin/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Disko
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
# Home manager
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager-stable = {
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
# Tools + Utils
flake-utils.url = "github:numtide/flake-utils";
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
doomemacs = {
# Use git+https (not github:) so the modules submodule at sources/doom+
# (github.com/doomemacs/modules) is fetched. The github: tarball fetcher
# omits submodules, leaving the module tree empty.
url = "git+https://github.com/doomemacs/doomemacs.git?submodules=1";
flake = false;
};
i3ws = {
url = "github:myme/i3ws";
inputs.nixpkgs.follows = "nixpkgs";
};
dms = {
url = "github:AvengeMedia/DankMaterialShell/stable";
inputs.nixpkgs.follows = "nixpkgs";
};
annodate.url = "github:myme/annodate";
nixon.url = "github:myme/nixon";
piddif.url = "github:myme/piddif";
wallpapers = {
url = "gitlab:myme/wallpapers";
flake = false;
};
# Themes
alacritty-catppuccin = {
url = "github:catppuccin/alacritty";
flake = false;
};
alacritty-dracula = {
url = "github:dracula/alacritty";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
...
}@inputs:
let
overlays = [
inputs.agenix.overlays.default
inputs.i3ws.overlay
inputs.annodate.overlay
inputs.nixon.overlay
inputs.piddif.overlay
self.overlays.default
];
lib = nixpkgs.lib.extend (
final: _prev:
import ./lib {
inherit inputs overlays;
lib = final;
}
);
in
{
# Personal overlays
overlays.default = import ./overlay.nix {
inherit lib;
inherit (inputs)
doomemacs
nixpkgs
wallpapers
;
};
# NixOS machines
nixosConfigurations = lib.myme.allProfiles lib.myme.makeNixOS;
# Non-NixOS machines (Fedora, WSL, ++)
homeConfigurations = lib.myme.nixos2hm { inherit (self) nixosConfigurations; };
# Installation mediums
sdImages = builtins.mapAttrs (
_name: config: config.config.system.build.sdImage
) self.nixosConfigurations;
}
//
flake-utils.lib.eachSystem
[
"aarch64-linux"
"x86_64-linux"
"aarch64-darwin"
]
(
system:
let
pkgs = import nixpkgs { inherit system overlays; };
isLinux = lib.hasSuffix "-linux" system;
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
pre-commit-check = inputs.git-hooks.lib.${system}.run {
src = ./.;
default_stages = [ "pre-push" ];
hooks = {
treefmt = {
enable = true;
package = treefmtEval.config.build.wrapper;
};
statix.enable = true;
deadnix.enable = true;
gitleaks = {
enable = true;
name = "gitleaks";
description = "Detect hardcoded secrets";
entry = "${pkgs.gitleaks}/bin/gitleaks detect --no-banner --redact --no-git --source=.";
language = "system";
pass_filenames = false;
};
};
};
in
{
# `nix fmt`
formatter = treefmtEval.config.build.wrapper;
# `nix flake check`
checks.pre-commit = pre-commit-check;
# Apps for `nix run .#<app>` (Linux only)
apps = lib.optionalAttrs isLinux {
agenix = {
type = "app";
program = "${pkgs.agenix}/bin/agenix";
};
};
# All packages under pkgs.myme.pkgs from the overlay (Linux only)
packages = lib.optionalAttrs isLinux pkgs.myme.pkgs;
devShells = {
# Default dev shell (used by direnv) — installs the pre-push hook
default = pkgs.mkShell {
inherit (pre-commit-check) shellHook;
buildInputs =
pre-commit-check.enabledPackages
++ lib.optionals isLinux (
with pkgs;
[
agenix
disko
myme.pkgs.nixos-bootstrap
]
);
};
}
// lib.optionalAttrs isLinux {
# For hacking on XMonad
xmonad = pkgs.mkShell {
buildInputs = with pkgs; [
(ghc.withPackages (
ps: with ps; [
xmonad
xmonad-contrib
]
))
];
};
};
}
);
}