-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
160 lines (144 loc) · 3.81 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-master.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
dircolors-solarized = {
url = "github:seebi/dircolors-solarized";
flake = false;
};
fzf-pass = {
url = "github:cprussin/fzf-pass";
flake = false;
};
gpg-key = {
url = "https://connor.prussin.net/pubkey.asc";
flake = false;
};
mkCli.url = "github:cprussin/mkCli";
gmail-new-mail-counter.url = "github:cprussin/gmail-new-mail-counter";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
notify-send = {
url = "github:vlevit/notify-send.sh";
flake = false;
};
zoom-frm = {
url = "github:cprussin/zoom-frm";
flake = false;
};
};
outputs = {
nixpkgs,
flake-utils,
mkCli,
home-manager,
nixos-hardware,
...
} @ flake-inputs: let
password-utils-overlay = final: _: {
inherit (final.callPackage ./lib/passwords.nix {}) passwordUtils;
};
cli-overlay = final: _: {
cli = final.callPackage ./cli.nix {};
};
iot-overlay = final: _: {
iot-devices = final.callPackage ./config/iot {};
};
release = import "${nixpkgs}/nixos/release.nix";
isoDir = ./isos;
mkMinimalIso = name:
builtins.mapAttrs (_: drv: {"${name}" = drv;})
(release {
nixpkgs = {
inherit (nixpkgs) outPath;
revCount = 0;
shortRev = builtins.substring 0 7 nixpkgs.rev;
};
stableBranch = true;
supportedSystems = ["x86_64-linux"];
configuration = "${toString isoDir}/${name}.nix";
})
.iso_minimal;
isos = mkMinimalIso "gpg-offline";
in
(
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
password-utils-overlay
mkCli.overlays.default
cli-overlay
iot-overlay
];
config = {};
};
in {
packages =
(isos."${system}" or {})
// {
inherit (pkgs) iot-devices;
};
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.git
pkgs.passwordUtils
pkgs.colmena
pkgs.cli
];
};
}
)
)
// {
colmena = let
# See https://jade.fyi/blog/flakes-arent-real/ for why we do this and
# don't use `specialArgs`.
injectFlakeInputs = {lib, ...}: {
options.flake-inputs = lib.mkOption {
type = lib.types.attrsOf lib.types.unspecified;
};
config = {
inherit flake-inputs;
};
};
machineDir = ./config/machines;
mkMachine = {
targetHost,
extraModules ? [],
}: {
deployment = {inherit targetHost;};
imports =
extraModules
++ [
home-manager.nixosModules.home-manager
injectFlakeInputs
"${toString machineDir}/${targetHost}"
];
};
in {
meta = {
nixpkgs = import nixpkgs {
system = "x86_64-linux";
};
};
aries = mkMachine {
targetHost = "aries";
extraModules = [
nixos-hardware.nixosModules.framework-11th-gen-intel
];
};
crux = mkMachine {
targetHost = "crux";
};
};
overlays.iot-devices = iot-overlay;
};
}