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