This repository has no description
6.8 kB
211 lines
1{
2 description = "lassulus superconfig";
3
4 inputs = {
5 nixpkgs.url = "github:lassulus/nixpkgs/nixos-unstable";
6 # nixpkgs.url = "path:/home/lass/tmp/nixpkgs-disk-debug";
7 # nixpkgs.url = "git+file:/home/lass/src/nixpkgs";
8 # nixpkgs.url = "git+file:/Users/lassulus/src/nixpkgs";
9
10 flake-parts.url = "github:hercules-ci/flake-parts";
11
12 nix-index-database.url = "github:nix-community/nix-index-database";
13 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
14
15 nixvim.url = "github:nix-community/nixvim";
16 nixvim.inputs.nixpkgs.follows = "nixpkgs";
17
18 clan-core.url = "git+https://git.clan.lol/clan/clan-core";
19 # clan-core.url = "path:/Users/lassulus/src/clan/clan-core";
20 # clan-core.url = "git+file:/home/lass/src/clan/clan-core";
21 clan-core.inputs.nixpkgs.follows = "nixpkgs";
22 clan-core.inputs.flake-parts.follows = "flake-parts";
23 clan-core.inputs.disko.follows = "disko";
24
25 stockholm.url = "git+https://github.com/krebs/stockholm?submodules=1";
26 # stockholm.url = "git+https://cgit.lassul.us/stockholm";
27 # stockholm.url = "path:/home/lass/sync/stockholm";
28 stockholm.inputs.nixpkgs.follows = "nixpkgs";
29 stockholm.inputs.buildbot-nix.follows = "";
30
31 disko.url = "github:nix-community/disko";
32 # disko.url = "path:/home/lass/src/disko/";
33 disko.inputs.nixpkgs.follows = "nixpkgs";
34
35 nixos-hardware.url = "github:nixos/nixos-hardware";
36
37 nether.url = "github:krebs/nether";
38 # nether.url = "git+file:/home/lass/src/nether";
39 nether.inputs.nixpkgs.follows = "nixpkgs";
40 nether.inputs.clan-core.follows = "clan-core";
41 nether.inputs.data-mesher.follows = "";
42
43 spora.url = "github:krebs/spora";
44 # spora.url = "git+file:/home/lass/src/spora";
45 spora.inputs.nixpkgs.follows = "nixpkgs";
46
47 nix-darwin.url = "github:LnL7/nix-darwin";
48 nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
49
50 nix-rosetta-builder.url = "github:cpick/nix-rosetta-builder";
51 nix-rosetta-builder.inputs.nixpkgs.follows = "nixpkgs";
52
53 nixos-facter.url = "github:numtide/nixos-facter-modules";
54
55 treefmt-nix.url = "github:numtide/treefmt-nix";
56 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
57
58 le_menu.url = "github:lassulus/le_menu";
59 # le_menu.url = "git+file:/home/lass/src/le_menu";
60 le_menu.inputs.nixpkgs.follows = "nixpkgs";
61 };
62
63 outputs =
64 inputs@{
65 self,
66 flake-parts,
67 nixpkgs,
68 clan-core,
69 ...
70 }:
71 let
72 clan = clan-core.lib.buildClan {
73 self = self;
74 specialArgs.self = self;
75 modules = import ./clan_modules { inherit nixpkgs; };
76 inventory = {
77 meta.name = "superconfig";
78 machines = {
79 ignavia.tags = [
80 "laptop"
81 "focus"
82 ];
83 mors.tags = [
84 "laptop"
85 "focus"
86 ];
87 aergia.tags = [
88 "laptop"
89 "focus"
90 ];
91 barnacle = {
92 machineClass = "darwin";
93 tags = [
94 "laptop"
95 "focus"
96 ];
97 };
98 icarus.tags = [ "laptop" ];
99 prism.tags = [ "server" ];
100 neoprism.tags = [ "server" ];
101 };
102 instances = {
103 tor = {
104 roles.server.tags.all = { };
105 };
106 internet = {
107 roles.default.machines = {
108 prism.settings.host = "ssh://prism.lassul.us:45621";
109 neoprism.settings.host = "ssh://neoprism.lassul.us:45621";
110 };
111 };
112 state-version = {
113 module.name = "importer";
114 roles.default.tags.all = { };
115 roles.default.settings.extraModules = [
116 {
117 clan.core.state-version.enable = true;
118 }
119 ];
120 };
121 };
122 };
123 machines =
124 nixpkgs.lib.mapAttrs
125 (machineName: _: {
126 imports = [
127 ./machines/${machineName}/physical.nix
128 ];
129 })
130 (
131 nixpkgs.lib.filterAttrs (
132 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
133 ) (builtins.readDir ./machines)
134 );
135 };
136 in
137 flake-parts.lib.mkFlake { inherit inputs; } {
138 systems = [
139 "x86_64-linux"
140 "aarch64-linux"
141 "aarch64-darwin"
142 "x86_64-darwin"
143 ];
144 imports =
145 [
146 ./formatter.nix
147 ./5pkgs/flake-module.nix
148 ./keys/flake-module.nix
149 ./wrapperModules/flake-module.nix
150 ]
151 ++ (
152 # Auto-import all flake-module.nix files from tools subdirectories
153 let
154 toolDirs = builtins.attrNames (
155 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
156 );
157 in
158 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
159 );
160 flake.nixosConfigurations = clan.nixosConfigurations;
161 flake.clanInternals = clan.clanInternals;
162 flake.darwinConfigurations = clan.darwinConfigurations;
163 flake.clan = clan;
164 perSystem =
165 {
166 lib,
167 pkgs,
168 system,
169 ...
170 }:
171 {
172 packages = {
173 default = inputs.le_menu.lib.buildMenu {
174 inherit pkgs;
175 menuConfig = {
176 vim.run = "nix run ${self}#nvim";
177 shell.run = "nix run ${self}#shell";
178 machines.submenu = lib.mapAttrs (name: _machine: {
179 submenu.ssh.submenu = {
180 retiolum.run = "ssh -t ${name}.r";
181 spora.run = "ssh ${name}.s";
182 nether.run = "ssh ${name}.n";
183 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
184 };
185 }) self.nixosConfigurations;
186 debug.run = "env";
187 };
188 };
189 clan-cli = clan-core.packages.${system}.clan-cli;
190 };
191 devShells.default = pkgs.mkShell {
192 packages = [
193 nixpkgs.legacyPackages.${system}.nil
194 nixpkgs.legacyPackages.${system}.nixd
195 (self.legacyPackages.${system}.bin_shim {
196 name = "clan";
197 pkg_name = "clan-cli";
198 })
199 ];
200 };
201 };
202 flake.lib = import ./lib { inherit (nixpkgs) lib; };
203 flake.libWithPkgs = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
204 system:
205 import ./lib/pkgs.nix {
206 inherit (nixpkgs) lib;
207 pkgs = nixpkgs.legacyPackages.${system};
208 }
209 );
210 };
211}