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