This repository has no description
5.8 kB
185 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:///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 nixos-facter.url = "github:numtide/nixos-facter-modules";
50
51 treefmt-nix.url = "github:numtide/treefmt-nix";
52 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
53
54 le_menu.url = "github:lassulus/le_menu";
55 # le_menu.url = "git+file:/home/lass/src/le_menu";
56 le_menu.inputs.nixpkgs.follows = "nixpkgs";
57 };
58
59 outputs =
60 inputs@{
61 self,
62 flake-parts,
63 nixpkgs,
64 clan-core,
65 ...
66 }:
67 let
68 clan = clan-core.lib.buildClan {
69 self = self;
70 specialArgs.self = self;
71 inventory = {
72 meta.name = "superconfig";
73 machines = {
74 ignavia.tags = [
75 "laptop"
76 "focus"
77 ];
78 mors.tags = [
79 "laptop"
80 "focus"
81 ];
82 aergia.tags = [
83 "laptop"
84 "focus"
85 ];
86 barnacle = {
87 machineClass = "darwin";
88 tags = [
89 "laptop"
90 "focus"
91 ];
92 };
93 icarus.tags = [ "laptop" ];
94 prism.tags = [ "server" ];
95 neoprism.tags = [ "server" ];
96 };
97 services = {
98 state-version.x.roles.default.tags = [
99 "all"
100 ];
101 };
102 };
103 machines =
104 nixpkgs.lib.mapAttrs
105 (machineName: _: {
106 imports = [
107 ./machines/${machineName}/physical.nix
108 ];
109 })
110 (
111 nixpkgs.lib.filterAttrs (
112 machineName: _: builtins.pathExists ./machines/${machineName}/physical.nix
113 ) (builtins.readDir ./machines)
114 );
115 };
116 in
117 flake-parts.lib.mkFlake { inherit inputs; } {
118 systems = [
119 "x86_64-linux"
120 "aarch64-linux"
121 "aarch64-darwin"
122 "x86_64-darwin"
123 ];
124 imports =
125 [
126 ./formatter.nix
127 ]
128 ++ (
129 # Auto-import all flake-module.nix files from tools subdirectories
130 let
131 toolDirs = builtins.attrNames (
132 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
133 );
134 in
135 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
136 );
137 flake.nixosConfigurations = clan.nixosConfigurations;
138 flake.clanInternals = clan.clanInternals;
139 flake.darwinConfigurations = clan.darwinConfigurations;
140 perSystem =
141 {
142 lib,
143 pkgs,
144 system,
145 ...
146 }:
147 {
148 packages =
149 (lib.mapAttrs (name: _v_: pkgs.callPackage ./5pkgs/${name} { }) (builtins.readDir ./5pkgs))
150 // {
151 default = inputs.le_menu.lib.buildMenu {
152 inherit pkgs;
153 menuConfig = {
154 vim.run = "nix run ${self}#nvim";
155 shell.run = "nix run ${self}#shell";
156 machines.submenu = lib.mapAttrs (name: _machine: {
157 submenu.ssh.submenu = {
158 retiolum.run = "ssh -t ${name}.r";
159 spora.run = "ssh ${name}.s";
160 nether.run = "ssh ${name}.n";
161 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
162 };
163 }) self.nixosConfigurations;
164 debug.run = "env";
165 };
166 };
167 clan-cli = clan-core.packages.${system}.clan-cli;
168 };
169 devShells.default = pkgs.mkShell {
170 packages = [
171 clan-core.packages.${system}.clan-cli
172 nixpkgs.legacyPackages.${system}.nil
173 nixpkgs.legacyPackages.${system}.nixd
174 ];
175 };
176 };
177 flake.keys = {
178 pgp.yubi = {
179 key = ./keys/yubi.pgp;
180 id = "DBCD757846069B392EA9401D6657BE8A8D1EE807";
181 };
182 ssh = builtins.readFile ./keys/yubi.ssh;
183 };
184 };
185}