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