This repository has no description
6.2 kB
195 lines
1{
2 description = "lassulus superconfig";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 # nixpkgs.url = "path:/home/lass/tmp/nixpkgs-disk-debug";
7 # nixpkgs.url = "git+file:/home/lass/src/nixpkgs";
8
9 flake-parts.url = "github:hercules-ci/flake-parts";
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.flake-parts.follows = "flake-parts";
22 clan-core.inputs.disko.follows = "disko";
23
24 stockholm.url = "git+https://github.com/krebs/stockholm?submodules=1";
25 # stockholm.url = "git+https://cgit.lassul.us/stockholm";
26 # stockholm.url = "path:/home/lass/sync/stockholm";
27 stockholm.inputs.nixpkgs.follows = "nixpkgs";
28 stockholm.inputs.buildbot-nix.follows = "";
29
30 disko.url = "github:nix-community/disko";
31 # disko.url = "path:/home/lass/src/disko/";
32 disko.inputs.nixpkgs.follows = "nixpkgs";
33
34 nixos-hardware.url = "github:nixos/nixos-hardware";
35
36 nether.url = "github:krebs/nether";
37 # nether.url = "git+file:/home/lass/src/nether";
38 nether.inputs.nixpkgs.follows = "nixpkgs";
39 nether.inputs.clan-core.follows = "clan-core";
40 nether.inputs.data-mesher.follows = "";
41
42 spora.url = "github:krebs/spora";
43 # spora.url = "git+file:/home/lass/src/spora";
44 spora.inputs.nixpkgs.follows = "nixpkgs";
45
46 nix-darwin.url = "github:LnL7/nix-darwin";
47 nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
48
49 nix-rosetta-builder.url = "github:cpick/nix-rosetta-builder";
50 nix-rosetta-builder.inputs.nixpkgs.follows = "nixpkgs";
51
52 nixos-facter.url = "github:numtide/nixos-facter-modules";
53
54 treefmt-nix.url = "github:numtide/treefmt-nix";
55 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
56
57 le_menu.url = "github:lassulus/le_menu";
58 # le_menu.url = "git+file:/home/lass/src/le_menu";
59 le_menu.inputs.nixpkgs.follows = "nixpkgs";
60 };
61
62 outputs =
63 inputs@{
64 self,
65 flake-parts,
66 nixpkgs,
67 clan-core,
68 ...
69 }:
70 let
71 clan = clan-core.lib.buildClan {
72 self = self;
73 specialArgs.self = self;
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 state-version = {
102 module.name = "importer";
103 roles.default.tags.all = { };
104 roles.default.settings.extraModules = [
105 {
106 clan.core.state-version.enable = true;
107 }
108 ];
109 };
110 };
111 };
112 machines =
113 nixpkgs.lib.mapAttrs
114 (machineName: _: {
115 imports = [
116 ./machines/${machineName}/physical.nix
117 ];
118 })
119 (
120 nixpkgs.lib.filterAttrs (
121 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
122 ) (builtins.readDir ./machines)
123 );
124 };
125 in
126 flake-parts.lib.mkFlake { inherit inputs; } {
127 systems = [
128 "x86_64-linux"
129 "aarch64-linux"
130 "aarch64-darwin"
131 "x86_64-darwin"
132 ];
133 imports =
134 [
135 ./formatter.nix
136 ./5pkgs/flake-module.nix
137 ./keys/flake-module.nix
138 ]
139 ++ (
140 # Auto-import all flake-module.nix files from tools subdirectories
141 let
142 toolDirs = builtins.attrNames (
143 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
144 );
145 in
146 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
147 );
148 flake.nixosConfigurations = clan.nixosConfigurations;
149 flake.clanInternals = clan.clanInternals;
150 flake.darwinConfigurations = clan.darwinConfigurations;
151 perSystem =
152 {
153 lib,
154 pkgs,
155 system,
156 ...
157 }:
158 {
159 packages = {
160 default = inputs.le_menu.lib.buildMenu {
161 inherit pkgs;
162 menuConfig = {
163 vim.run = "nix run ${self}#nvim";
164 shell.run = "nix run ${self}#shell";
165 machines.submenu = lib.mapAttrs (name: _machine: {
166 submenu.ssh.submenu = {
167 retiolum.run = "ssh -t ${name}.r";
168 spora.run = "ssh ${name}.s";
169 nether.run = "ssh ${name}.n";
170 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
171 };
172 }) self.nixosConfigurations;
173 debug.run = "env";
174 };
175 };
176 clan-cli = clan-core.packages.${system}.clan-cli;
177 };
178 devShells.default = pkgs.mkShell {
179 packages = [
180 clan-core.packages.${system}.clan-cli
181 nixpkgs.legacyPackages.${system}.nil
182 nixpkgs.legacyPackages.${system}.nixd
183 ];
184 };
185 };
186 flake.lib = import ./lib { inherit (nixpkgs) lib; };
187 flake.libWithPkgs = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
188 system:
189 import ./lib/pkgs.nix {
190 inherit (nixpkgs) lib;
191 pkgs = nixpkgs.legacyPackages.${system};
192 }
193 );
194 };
195}