blob: c341ec4480e262795fa7fef0f6233faa4fb27efb [file] [log] [blame]
# Top-level file aggregating all machines managed from hscloud.
#
# This allows to have a common attrset of machines that can be deployed
# in the same way.
#
# Currently building/deployment is still done in a half-assed way:
#
# machine=edge01.waw.bgp.wtf
# nix-build -A 'ops.machines."'$machine'"'.toplevel
#
# This spits out a derivation path that correponds to the built config of that
# machine. To deploy it:
#
# d=/nix/store/nkdfoobarbazl0ybhazkmeyaylmaoqcr-nixos-system-edge01-20.09pre-git
# nix-copy-closure --to root@$machine $d
# ssh root@$machine $d/bin/switch-to-configuration
#
# TODO(q3k): merge this with //cluster/clustercfg - this should be unified!
{ hscloud, pkgs, ... }:
let
# Stopgap measure to import //cluster/nix machine definitions into new
# //ops/machines infrastructure.
# TODO(q3k): inject defs-cluster-k0.nix / defs-machines.nix content via
# nixos options instead of having module definitions loading it themselves,
# deduplicate list of machines below with defs-machines.nix somehow.
mkClusterMachine = name: pkgs.nixos ({ config, pkgs, ... }: {
# The hostname is used by //cluster/nix machinery to load the appropriate
# config from defs-machines into defs-cluster-k0.
networking.hostName = name;
imports = [
../cluster/nix/modules/base.nix
../cluster/nix/modules/kubernetes.nix
];
});
mkMachine = paths: pkgs.nixos ({ config, pkgs, ... }: {
imports = paths;
});
in {
"bc01n01.hswaw.net" = mkClusterMachine "bc01n01";
"bc01n02.hswaw.net" = mkClusterMachine "bc01n02";
"bc01n03.hswaw.net" = mkClusterMachine "bc01n03";
"dcr01s22.hswaw.net" = mkClusterMachine "dcr01s22";
"dcr01s24.hswaw.net" = mkClusterMachine "dcr01s24";
"edge01.waw.bgp.wtf" = mkMachine [
../bgpwtf/machines/edge01.waw.bgp.wtf.nix
../bgpwtf/machines/edge01.waw.bgp.wtf-hardware.nix
];
}