2020-06-07 14:03:12 +00:00
|
|
|
# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2020-04-30 04:49:19 +00:00
|
|
|
{ depot, lib, pkgs, ... }@args:
|
|
|
|
let
|
|
|
|
inherit (builtins) foldl' mapAttrs;
|
2020-05-08 22:26:21 +00:00
|
|
|
baseModule = name: { ... }: {
|
|
|
|
_module.args = args // {
|
|
|
|
rebuilder = rebuilder name;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
systemFor = systemName: config:
|
|
|
|
(depot.third_party.nixeval {
|
|
|
|
system = builtins.currentSystem;
|
|
|
|
modules = [ (baseModule systemName) (args: { imports = [ lib/common.nix config ]; }) ];
|
2020-11-01 18:25:01 +00:00
|
|
|
});
|
2020-11-01 14:25:17 +00:00
|
|
|
systems = [ "porcorosso" "ixvm-fra01" "marukuru" "clouvider-fra01" "totoro" "kusakabe" "swann" ];
|
2020-05-09 10:14:25 +00:00
|
|
|
rebuilder = system: (import ./lib/rebuilder.nix (args // { system = system; }));
|
2020-04-30 04:49:19 +00:00
|
|
|
systemCfgs = lib.genAttrs systems
|
2020-05-08 22:26:21 +00:00
|
|
|
(name: import (./. + "/${name}"));
|
2020-11-01 18:25:01 +00:00
|
|
|
evaledSystems = mapAttrs systemFor systemCfgs;
|
|
|
|
systemDrvs = mapAttrs (_: sys: sys.config.system.build.toplevel) evaledSystems;
|
|
|
|
systemTailscaleIPs = lib.mapAttrs' (n: v: lib.nameValuePair v [n]) (lib.filterAttrs (n: v: v != null) (mapAttrs (_: sys: sys.config.my.ip.tailscale) evaledSystems));
|
|
|
|
in systemDrvs // {
|
|
|
|
tailscaleIPs = systemTailscaleIPs;
|
|
|
|
}
|