This repository has no description
6.8 kB
211 lines
1{
2 description = "lassulus superconfig";
3
4 inputs = {
5 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6 # nixpkgs.url = "github:lassulus/nixpkgs/nixos-unstable";
7 # nixpkgs.url = "path:/home/lass/tmp/nixpkgs-disk-debug";
8 # nixpkgs.url = "git+file:/home/lass/src/nixpkgs";
9 # nixpkgs.url = "git+file:/Users/lassulus/src/nixpkgs";
10
11 flake-parts.url = "github:hercules-ci/flake-parts";
12
13 nix-index-database.url = "github:nix-community/nix-index-database";
14 nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
15
16 nixvim.url = "github:nix-community/nixvim";
17 nixvim.inputs.nixpkgs.follows = "nixpkgs";
18
19 clan-core.url = "git+https://git.clan.lol/clan/clan-core";
20 # clan-core.url = "path:/Users/lassulus/src/clan/clan-core";
21 # clan-core.url = "git+file:/home/lass/src/clan/clan-core";
22 clan-core.inputs.nixpkgs.follows = "nixpkgs";
23 clan-core.inputs.flake-parts.follows = "flake-parts";
24 clan-core.inputs.disko.follows = "disko";
25
26 stockholm.url = "git+https://github.com/krebs/stockholm?submodules=1";
27 # stockholm.url = "git+https://cgit.lassul.us/stockholm";
28 # stockholm.url = "path:/home/lass/sync/stockholm";
29 stockholm.inputs.nixpkgs.follows = "nixpkgs";
30 stockholm.inputs.buildbot-nix.follows = "";
31
32 disko.url = "github:nix-community/disko";
33 # disko.url = "path:/home/lass/src/disko/";
34 disko.inputs.nixpkgs.follows = "nixpkgs";
35
36 nixos-hardware.url = "github:nixos/nixos-hardware";
37
38 nether.url = "github:krebs/nether";
39 # nether.url = "git+file:/home/lass/src/nether";
40 nether.inputs.nixpkgs.follows = "nixpkgs";
41 nether.inputs.clan-core.follows = "clan-core";
42 nether.inputs.data-mesher.follows = "";
43
44 spora.url = "github:krebs/spora";
45 # spora.url = "git+file:/home/lass/src/spora";
46 spora.inputs.nixpkgs.follows = "nixpkgs";
47
48 nix-darwin.url = "github:LnL7/nix-darwin";
49 nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
50
51 nix-rosetta-builder.url = "github:cpick/nix-rosetta-builder";
52 nix-rosetta-builder.inputs.nixpkgs.follows = "nixpkgs";
53
54 nixos-facter.url = "github:numtide/nixos-facter-modules";
55
56 treefmt-nix.url = "github:numtide/treefmt-nix";
57 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
58
59 le_menu.url = "github:lassulus/le_menu";
60 # le_menu.url = "git+file:/home/lass/src/le_menu";
61 le_menu.inputs.nixpkgs.follows = "nixpkgs";
62 };
63
64 outputs =
65 inputs@{
66 self,
67 flake-parts,
68 nixpkgs,
69 clan-core,
70 ...
71 }:
72 let
73 clan = clan-core.lib.buildClan {
74 self = self;
75 specialArgs.self = self;
76 modules = import ./clan_modules { inherit nixpkgs; };
77 inventory = {
78 meta.name = "superconfig";
79 machines = {
80 ignavia.tags = [
81 "laptop"
82 "focus"
83 ];
84 mors.tags = [
85 "laptop"
86 "focus"
87 ];
88 aergia.tags = [
89 "laptop"
90 "focus"
91 ];
92 barnacle = {
93 machineClass = "darwin";
94 tags = [
95 "laptop"
96 "focus"
97 ];
98 };
99 icarus.tags = [ "laptop" ];
100 prism.tags = [ "server" ];
101 neoprism.tags = [ "server" ];
102 };
103 instances = {
104 tor = {
105 roles.server.tags.all = { };
106 };
107 internet = {
108 roles.default.machines = {
109 prism.settings.host = "ssh://prism.lassul.us:45621";
110 neoprism.settings.host = "ssh://neoprism.lassul.us:45621";
111 };
112 };
113 state-version = {
114 module.name = "importer";
115 roles.default.tags.all = { };
116 roles.default.settings.extraModules = [
117 {
118 clan.core.state-version.enable = true;
119 }
120 ];
121 };
122 };
123 };
124 machines =
125 nixpkgs.lib.mapAttrs
126 (machineName: _: {
127 imports = [
128 ./machines/${machineName}/physical.nix
129 ];
130 })
131 (
132 nixpkgs.lib.filterAttrs (
133 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
134 ) (builtins.readDir ./machines)
135 );
136 };
137 in
138 flake-parts.lib.mkFlake { inherit inputs; } {
139 systems = [
140 "x86_64-linux"
141 "aarch64-linux"
142 "aarch64-darwin"
143 "x86_64-darwin"
144 ];
145 imports = [
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}