This repository has no description
6.3 kB
196 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 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 ]
131 ++ (
132 # Auto-import all flake-module.nix files from tools subdirectories
133 let
134 toolDirs = builtins.attrNames (
135 nixpkgs.lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./tools)
136 );
137 in
138 map (dir: ./tools + "/${dir}/flake-module.nix") toolDirs
139 );
140 flake.nixosConfigurations = clan.nixosConfigurations;
141 flake.clanInternals = clan.clanInternals;
142 flake.darwinConfigurations = clan.darwinConfigurations;
143 perSystem =
144 {
145 lib,
146 pkgs,
147 system,
148 ...
149 }:
150 {
151 packages =
152 (lib.mapAttrs (name: _v_: pkgs.callPackage ./5pkgs/${name} { }) (builtins.readDir ./5pkgs))
153 // {
154 default = inputs.le_menu.lib.buildMenu {
155 inherit pkgs;
156 menuConfig = {
157 vim.run = "nix run ${self}#nvim";
158 shell.run = "nix run ${self}#shell";
159 machines.submenu = lib.mapAttrs (name: _machine: {
160 submenu.ssh.submenu = {
161 retiolum.run = "ssh -t ${name}.r";
162 spora.run = "ssh ${name}.s";
163 nether.run = "ssh ${name}.n";
164 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
165 };
166 }) self.nixosConfigurations;
167 debug.run = "env";
168 };
169 };
170 clan-cli = clan-core.packages.${system}.clan-cli;
171 };
172 devShells.default = pkgs.mkShell {
173 packages = [
174 clan-core.packages.${system}.clan-cli
175 nixpkgs.legacyPackages.${system}.nil
176 nixpkgs.legacyPackages.${system}.nixd
177 ];
178 };
179 };
180 flake.lib = import ./lib { inherit (nixpkgs) lib; };
181 flake.libWithPkgs = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
182 system:
183 import ./lib/pkgs.nix {
184 inherit (nixpkgs) lib;
185 pkgs = nixpkgs.legacyPackages.${system};
186 }
187 );
188 flake.keys = {
189 pgp.yubi = {
190 key = ./keys/yubi.pgp;
191 id = "DBCD757846069B392EA9401D6657BE8A8D1EE807";
192 };
193 ssh = builtins.readFile ./keys/yubi.ssh;
194 };
195 };
196}