-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
152 lines (142 loc) · 4.78 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
{
description = "My Nix-ified infrastructure and personal monorepo";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
# Dotfiles management
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
# Provides hardware-specific NixOS modules
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
flake-utils.url = "github:numtide/flake-utils";
# Provides secureboot support
lanzaboote = {
url = "github:nix-community/lanzaboote";
inputs.nixpkgs.follows = "nixpkgs";
inputs.pre-commit-hooks-nix.follows = "pre-commit-hooks";
};
# Provides a handy "command not found" nixpkgs hook
nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
# Secrets management
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
inputs.darwin.follows = "darwin";
};
# Declerative management of flatpaks
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1";
# Create VM/images/containers off of NixOS modules
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-topology = {
url = "github:oddlama/nix-topology";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.pre-commit-hooks.follows = "pre-commit-hooks";
};
flake-graph = {
url = "github:nikitawootten/flake-graph";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
};
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
niri = {
url = "github:sodiboo/niri-flake";
inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, darwin, flake-utils, pre-commit-hooks
, ... }@inputs:
let
secrets = import ./secrets;
keys = import ./keys.nix;
# Args passed to home-manager and nixos modules
specialArgs = { inherit self inputs secrets keys; };
in {
homeModules = import ./homeModules;
nixosModules = import ./hostModules;
nixosConfigurations = import ./hosts { inherit specialArgs nixpkgs; };
darwinConfigurations =
import ./darwinHosts { inherit darwin specialArgs; };
darwinModules = import ./darwinModules;
} // flake-utils.lib.eachDefaultSystem (system: rec {
pkgs = import nixpkgs {
inherit system;
overlays = [ inputs.nix-topology.overlays.default ];
};
packages = import ./packages { inherit pkgs; };
topology = import inputs.nix-topology {
inherit pkgs;
modules = [
./topology.nix
# { nixosConfigurations = self.nixosConfigurations; }
{
nixosConfigurations = {
iris = self.nixosConfigurations.iris;
hades = self.nixosConfigurations.hades;
dionysus = self.nixosConfigurations.dionysus;
hermes = self.nixosConfigurations.hermes;
};
}
];
};
checks.pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = { nixfmt-classic.enable = true; };
};
devShells.default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
NIX_CONFIG = "extra-experimental-features = nix-command flakes";
name = "infra";
packages = with pkgs;
[
nix
git
# So that Home-Manager knows what configuration to target
hostname
# Editor support
nixd
pwgen
jq
graphviz
helix
tree
] ++ [
inputs.home-manager.packages.${system}.default
inputs.agenix.packages.${system}.default
inputs.flake-graph.packages.${system}.default
] ++ self.checks.${system}.pre-commit-check.enabledPackages
++ lib.lists.optionals pkgs.stdenv.isLinux (with pkgs;
[
# Secureboot
sbctl
]);
};
formatter = pkgs.nixfmt-classic;
});
}