This repository has no description
6.3 kB
189 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 icarus.tags = [ "laptop" ];
87 prism.tags = [ "server" ];
88 neoprism.tags = [ "server" ];
89 };
90 services = {
91 state-version.x.roles.default.tags = [
92 "all"
93 ];
94 };
95 };
96 machines = nixpkgs.lib.mapAttrs (machineName: _: {
97
98 imports = [
99 ./machines/${machineName}/physical.nix
100 (
101 { config, ... }:
102 {
103 clan.core.facts.secretStore = "password-store";
104 clan.core.facts.secretUploadDirectory = nixpkgs.lib.mkDefault "/etc/secrets";
105 clan.core.vars.settings.secretStore = "password-store";
106 clan.core.networking.targetHost = "root@${machineName}";
107 krebs.secret.directory = config.clan.core.facts.secretUploadDirectory;
108 nixpkgs.overlays = [
109 self.inputs.stockholm.overlays.default
110 (import (self.inputs.stockholm.inputs.nix-writers + "/pkgs")) # TODO get rid of that overlay
111 ];
112 }
113 )
114 ./2configs
115 ./3modules
116 self.inputs.stockholm.nixosModules.krebs
117 ];
118 }) (builtins.readDir ./machines);
119 };
120 in
121 flake-parts.lib.mkFlake { inherit inputs; } {
122 systems = [
123 "x86_64-linux"
124 "aarch64-linux"
125 "aarch64-darwin"
126 "x86_64-darwin"
127 ];
128 imports = [
129 ./formatter.nix
130 ] ++ (
131 # Auto-import all flake-module.nix files from tools subdirectories
132 let
133 toolDirs = builtins.attrNames (nixpkgs.lib.filterAttrs
134 (_: type: type == "directory")
135 (builtins.readDir ./tools));
136 in
137 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
138 );
139 flake.nixosConfigurations = clan.nixosConfigurations;
140 flake.clanInternals = clan.clanInternals;
141 perSystem =
142 {
143 lib,
144 pkgs,
145 system,
146 ...
147 }:
148 {
149 packages =
150 (lib.mapAttrs (name: _v_: pkgs.callPackage ./5pkgs/${name} { }) (builtins.readDir ./5pkgs))
151 // {
152 default = inputs.le_menu.lib.buildMenu {
153 inherit pkgs;
154 menuConfig = {
155 vim.run = "nix run ${self}#nvim";
156 shell.run = "nix run ${self}#shell";
157 machines.submenu = lib.mapAttrs (name: _machine: {
158 submenu.ssh.submenu = {
159 retiolum.run = "ssh -t ${name}.r";
160 spora.run = "ssh ${name}.s";
161 nether.run = "ssh ${name}.n";
162 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
163 };
164 }) self.nixosConfigurations;
165 debug.run = "env";
166 };
167 };
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.darwinConfigurations.barnacle = inputs.nix-darwin.lib.darwinSystem {
178 specialArgs.self = self;
179 modules = [ ./darwin/barnacle/config.nix ];
180 };
181 flake.keys = {
182 pgp.yubi = {
183 key = ./keys/yubi.pgp;
184 id = "DBCD757846069B392EA9401D6657BE8A8D1EE807";
185 };
186 ssh = builtins.readFile ./keys/yubi.ssh;
187 };
188 };
189}