This repository has no description
5.8 kB
177 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 machines = {
73 ignavia.tags = [
74 "laptop"
75 "focus"
76 ];
77 mors.tags = [
78 "laptop"
79 "focus"
80 ];
81 aergia.tags = [
82 "laptop"
83 "focus"
84 ];
85 icarus.tags = [ "laptop" ];
86 prism.tags = [ "server" ];
87 neoprism.tags = [ "server" ];
88 };
89 services = {
90 state-version.x.roles.default.tags = [
91 "all"
92 ];
93 };
94 };
95 machines = nixpkgs.lib.mapAttrs (machineName: _: {
96
97 imports = [
98 ./machines/${machineName}/physical.nix
99 (
100 { config, ... }:
101 {
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.clan.core.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/wifi-qr.nix
132 ./tools/get-spora-hosts.nix
133 ./formatter.nix
134 ];
135 flake.nixosConfigurations = clan.nixosConfigurations;
136 flake.clanInternals = clan.clanInternals;
137 perSystem =
138 {
139 lib,
140 pkgs,
141 system,
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 nixpkgs.legacyPackages.${system}.nil
169 nixpkgs.legacyPackages.${system}.nixd
170 ];
171 };
172 };
173 flake.darwinConfigurations.barnacle = inputs.nix-darwin.lib.darwinSystem {
174 modules = [ ./darwin/barnacle/config.nix ];
175 };
176 };
177}