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