This repository has no description
5.8 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 nixvim.url = "github:nix-community/nixvim";
10 nixvim.inputs.nixpkgs.follows = "nixpkgs";
11
12 clan-core.url = "git+https://git.clan.lol/clan/clan-core";
13 # clan-core.url = "path:///home/lass/src/clan/clan-core";
14 # clan-core.url = "git+file:/home/lass/src/clan/clan-core";
15 clan-core.inputs.nixpkgs.follows = "nixpkgs";
16 clan-core.inputs.flake-parts.follows = "flake-parts";
17 clan-core.inputs.disko.follows = "disko";
18
19 stockholm.url = "github:krebs/stockholm";
20 # stockholm.url = "git+https://cgit.lassul.us/stockholm";
21 # stockholm.url = "path:/home/lass/sync/stockholm";
22 stockholm.inputs.nixpkgs.follows = "nixpkgs";
23 stockholm.inputs.buildbot-nix.follows = "";
24
25 disko.url = "github:nix-community/disko";
26 # disko.url = "path:/home/lass/src/disko/";
27 disko.inputs.nixpkgs.follows = "nixpkgs";
28
29 nixos-hardware.url = "github:nixos/nixos-hardware";
30
31 data-mesher.url = "https://git.clan.lol/clan/data-mesher/archive/main.tar.gz";
32 # data-mesher.url = "path:/home/lass/src/data-mesher/";
33 data-mesher.inputs.nixpkgs.follows = "nixpkgs";
34
35 nether.url = "github:krebs/nether";
36 # nether.url = "git+file:/home/lass/src/nether";
37 nether.inputs.nixpkgs.follows = "nixpkgs";
38 nether.inputs.clan-core.follows = "clan-core";
39 nether.inputs.data-mesher.follows = "data-mesher";
40
41 spora.url = "github:krebs/spora";
42 # spora.url = "git+file:/home/lass/src/spora";
43 spora.inputs.nixpkgs.follows = "nixpkgs";
44
45 nix-darwin.url = "github:LnL7/nix-darwin";
46 nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
47
48 nixos-facter.url = "github:numtide/nixos-facter-modules";
49
50 treefmt-nix.url = "github:numtide/treefmt-nix";
51 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
52
53 le_menu.url = "github:lassulus/le_menu";
54 # le_menu.url = "git+file:/home/lass/src/le_menu";
55 le_menu.inputs.nixpkgs.follows = "nixpkgs";
56 };
57
58 outputs =
59 inputs@{
60 self,
61 flake-parts,
62 nixpkgs,
63 clan-core,
64 ...
65 }:
66 let
67 clan = clan-core.lib.buildClan {
68 directory = self;
69 specialArgs.self = self;
70 inventory = {
71 machines = {
72 ignavia.tags = [
73 "laptop"
74 "focus"
75 ];
76 mors.tags = [
77 "laptop"
78 "focus"
79 ];
80 aergia.tags = [
81 "laptop"
82 "focus"
83 ];
84 icarus.tags = [ "laptop" ];
85 prism.tags = [ "server" ];
86 };
87 services = {
88 state-version.x.roles.default.tags = [
89 "laptop"
90 "server"
91 ];
92 };
93 };
94 machines = nixpkgs.lib.mapAttrs (machineName: _: {
95
96 imports = [
97 ./machines/${machineName}/physical.nix
98 (
99 { config, ... }:
100 {
101 clan.core.machineName = machineName;
102 clan.core.facts.secretStore = "password-store";
103 clan.core.facts.secretUploadDirectory = nixpkgs.lib.mkDefault "/etc/secrets";
104 clan.core.vars.settings.secretStore = "password-store";
105 clan.networking.targetHost = "root@${machineName}";
106 krebs.secret.directory = config.clanCore.facts.secretUploadDirectory;
107 nixpkgs.overlays = [
108 self.inputs.stockholm.overlays.default
109 (import (self.inputs.stockholm.inputs.nix-writers + "/pkgs")) # TODO get rid of that overlay
110 ];
111 }
112 )
113 ./2configs
114 ./3modules
115 self.inputs.stockholm.nixosModules.krebs
116 ];
117 }) (builtins.readDir ./machines);
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 ./tools/nvim.nix
129 ./tools/astronvim/flake-module.nix
130 ./tools/zsh.nix
131 ./tools/get-spora-hosts.nix
132 ./formatter.nix
133 ];
134 flake.nixosConfigurations = clan.nixosConfigurations;
135 flake.clanInternals = clan.clanInternals;
136 perSystem =
137 {
138 lib,
139 pkgs,
140 system,
141 config,
142 ...
143 }:
144 {
145 packages =
146 (lib.mapAttrs (name: _v_: pkgs.callPackage ./5pkgs/${name} { }) (builtins.readDir ./5pkgs))
147 // {
148 default = inputs.le_menu.lib.buildMenu {
149 inherit pkgs;
150 menuConfig = {
151 vim.run = "nix run ${self}#nvim";
152 shell.run = "nix run ${self}#shell";
153 machines.submenu = lib.mapAttrs (name: _machine: {
154 submenu.ssh.submenu = {
155 retiolum.run = "ssh -t ${name}.r";
156 spora.run = "ssh ${name}.s";
157 nether.run = "ssh ${name}.n";
158 tor.run = "torify ssh $(pass show machines/${name}/tor-hostname)";
159 };
160 }) self.nixosConfigurations;
161 debug.run = "env";
162 };
163 };
164 };
165 devShells.default = pkgs.mkShell {
166 packages = [
167 clan-core.packages.${system}.clan-cli
168 config.treefmt.build.wrapper
169 ];
170 };
171 };
172 flake.darwinConfigurations.barnacle = inputs.nix-darwin.lib.darwinSystem {
173 modules = [ ./darwin/barnacle/config.nix ];
174 };
175 };
176}