forked from
lass.pds.lassul.us/superconfig
This repository has no description
6.2 kB
195 lines
1{
2 description = "lassulus superconfig";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/08f22084e6085d19bcfb4be30d1ca76ecb96fe54?shallow=1";
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:///home/lass/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 services = {
101 state-version.x.roles.default.tags = [
102 "all"
103 ];
104 };
105 };
106 machines =
107 nixpkgs.lib.mapAttrs
108 (machineName: _: {
109 imports = [
110 ./machines/${machineName}/physical.nix
111 ];
112 })
113 (
114 nixpkgs.lib.filterAttrs (
115 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
116 ) (builtins.readDir ./machines)
117 );
118 };
119 in
120 flake-parts.lib.mkFlake { inherit inputs; } {
121 systems = [
122 "x86_64-linux"
123 "aarch64-linux"
124 "aarch64-darwin"
125 "x86_64-darwin"
126 ];
127 imports =
128 [
129 ./formatter.nix
130 ./5pkgs/flake-module.nix
131 ]
132 ++ (
133 # Auto-import all flake-module.nix files from tools subdirectories
134 let
135 toolDirs = builtins.attrNames (
136 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
137 );
138 in
139 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
140 );
141 flake.nixosConfigurations = clan.nixosConfigurations;
142 flake.clanInternals = clan.clanInternals;
143 flake.darwinConfigurations = clan.darwinConfigurations;
144 perSystem =
145 {
146 lib,
147 pkgs,
148 system,
149 ...
150 }:
151 {
152 packages = {
153 default = inputs.le_menu.lib.buildMenu {
154 inherit pkgs;
155 menuConfig = {
156 vim.run = "nix run ${self}#nvim";
157 shell.run = "nix run ${self}#shell";
158 machines.submenu = lib.mapAttrs (name: _machine: {
159 submenu.ssh.submenu = {
160 retiolum.run = "ssh -t ${name}.r";
161 spora.run = "ssh ${name}.s";
162 nether.run = "ssh ${name}.n";
163 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
164 };
165 }) self.nixosConfigurations;
166 debug.run = "env";
167 };
168 };
169 clan-cli = clan-core.packages.${system}.clan-cli;
170 };
171 devShells.default = pkgs.mkShell {
172 packages = [
173 clan-core.packages.${system}.clan-cli
174 nixpkgs.legacyPackages.${system}.nil
175 nixpkgs.legacyPackages.${system}.nixd
176 ];
177 };
178 };
179 flake.lib = import ./lib { inherit (nixpkgs) lib; };
180 flake.libWithPkgs = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
181 system:
182 import ./lib/pkgs.nix {
183 inherit (nixpkgs) lib;
184 pkgs = nixpkgs.legacyPackages.${system};
185 }
186 );
187 flake.keys = {
188 pgp.yubi = {
189 key = ./keys/yubi.pgp;
190 id = "DBCD757846069B392EA9401D6657BE8A8D1EE807";
191 };
192 ssh.yubi = builtins.readFile ./keys/yubi.ssh;
193 };
194 };
195}