blob: 0e63228963d470242cc685590a2f84c6620155b9 [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
# d=$(nix-build -A 'ops.machines."'$machine'"'.toplevel)
#
# To then deploy derivation $d on $machine:
#
# nix-copy-closure --to root@$machine $d
# ssh root@$machine $d/bin/switch-to-configuration dry-activate
# ssh root@$machine $d/bin/switch-to-configuration test
# ssh root@$machine nix-env -p /nix/var/nix/profiles/system --set $d
# ssh root@$machine $d/bin/switch-to-configuration boot
#
# 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 = pkgs: 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 still lives on an old nixpkgs checkout.
# TODO(b/3): unpin and deploy.
"edge01.waw.bgp.wtf" = mkMachine (
import (pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs-channels";
rev = "c59ea8b8a0e7f927e7291c14ea6cd1bd3a16ff38";
sha256 = "1ak7jqx94fjhc68xh1lh35kh3w3ndbadprrb762qgvcfb8351x8v";
}) {}
) [
../bgpwtf/machines/edge01.waw.bgp.wtf.nix
../bgpwtf/machines/edge01.waw.bgp.wtf-hardware.nix
];
}