aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: e67610e05e6d9c323928acbbf5562f4e656119e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-parts.url = "github:hercules-ci/flake-parts";
    nixinate.url = "github:maxaudron/nixinate";

    secrets = {
      url = "git+ssh://git@gitlab.com/cocainefarm/k8s/secrets";
      flake = false;
    };
  };

  outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, flake-parts, nixinate, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      imports = [ nixinate.flakeModule ./lib ];
      flake =
        let
          system = "x86_64-linux";
          specialArgs = inputs // {
            nodes = self.nixosConfigurations;
          };

          overlay-unstable = final: prev: {
            unstable = import nixpkgs-unstable {
              system = prev.system;
              config.allowUnfree = true;
            };
          };

          overlays = { config, pkgs, ... }: {
            nixpkgs.overlays = [ overlay-unstable ];
          };

          mkSystem = modules: nixpkgs.lib.nixosSystem {
            inherit specialArgs system;
            modules = modules ++ (with self.nixosModules; [
              nixinate.nixosModules.default
              overlays

              common
              users
              wireguard
              crypto
            ]);
          };
        in
        {
          nixosModules = import ./modules;
          nixosConfigurations = with self.nixosModules; {
            # vultr-image = mkSystem [ common users image vultr ];

            ettves = mkSystem [ (import ./machines/ettves) kubernetes zfs teamspeak postgresql quassel powerdns acme authentik hydra homeassistant games languagetool git laplace ];
            phaenn = mkSystem [ (import ./machines/phaenn) zfs acme tlmp ];
            fra01 = mkSystem [ (import ./machines/fra01) vultr bgp powerdns acme garage ];
            nyc01 = mkSystem [ (import ./machines/nyc01) vultr bgp powerdns acme garage ];
            sin01 = mkSystem [ (import ./machines/sin01) vultr bgp powerdns acme garage ];
          };
        };
      systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
    };
}