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