summaryrefslogtreecommitdiff
path: root/systems/default.nix
blob: 6807a7171084e59a3f05902729487fc185b7b2e2 (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
63
64
65
66
67
68
69
70
71
72
73
{
  lib,
  inputs,
  self,
  withSystem,
  ...
}: let
  /*
  basic nixosSystem/darwinSystem wrapper; can override
  the exact builder by supplying an argument
  */
  mapSystems = builder:
    lib.mapAttrs (name: args:
      (args.builder or builder) (
        (lib.filterAttrs (n: _: n != "builder") args) # use builder but don't include it in output
        // {
          modules = args.modules ++ [./${name}];
          specialArgs = {inherit inputs self;};
        }
      ));

  mapDarwin = mapSystems inputs.darwin.lib.darwinSystem;
  mapNixOS = mapSystems inputs.nixpkgs.lib.nixosSystem;
  inherit (import ./common.nix {inherit inputs self;}) darwin nixos server;
in {
  flake = {
    darwinConfigurations = mapDarwin {
      caroline = {
        system = "x86_64-darwin";
        modules = darwin;
      };
    };

    nixosConfigurations = mapNixOS {
      glados = {
        system = "x86_64-linux";
        modules =
          [
            inputs.lanzaboote.nixosModules.lanzaboote
          ]
          ++ nixos;
      };

      glados-wsl = {
        system = "x86_64-linux";
        modules =
          [
            inputs.nixos-wsl.nixosModules.wsl
          ]
          ++ nixos;
      };

      atlas = {
        builder = inputs.nixpkgs-stable.lib.nixosSystem;
        system = "aarch64-linux";
        modules =
          [
            inputs.guzzle_api.nixosModules.default
          ]
          ++ server;
      };
    };

    openwrtConfigurations.turret = withSystem "x86_64-linux" ({pkgs, ...}:
      pkgs.callPackage ./turret {
        inherit (inputs) openwrt-imagebuilder;
      });
  };

  perSystem = {system, ...}: {
    apps = (inputs.nixinate.nixinate.${system} self).nixinate;
  };
}