2020-10-02 22:18:34 +00:00
|
|
|
# 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
|
2021-03-17 21:12:43 +00:00
|
|
|
# d=$(nix-build -A 'ops.machines."'$machine'"'.toplevel)
|
2020-10-02 22:18:34 +00:00
|
|
|
#
|
2021-03-17 21:12:43 +00:00
|
|
|
# To then deploy derivation $d on $machine:
|
2020-10-02 22:18:34 +00:00
|
|
|
#
|
|
|
|
# nix-copy-closure --to root@$machine $d
|
2021-04-18 18:12:20 +00:00
|
|
|
# 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
|
2020-10-02 22:18:34 +00:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2021-03-17 21:12:43 +00:00
|
|
|
mkMachine = pkgs: paths: pkgs.nixos ({ config, pkgs, ... }: {
|
2020-10-02 22:18:34 +00:00
|
|
|
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";
|
|
|
|
|
2021-03-17 21:12:43 +00:00
|
|
|
# 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";
|
|
|
|
}) {}
|
|
|
|
) [
|
2020-10-02 22:18:34 +00:00
|
|
|
../bgpwtf/machines/edge01.waw.bgp.wtf.nix
|
|
|
|
../bgpwtf/machines/edge01.waw.bgp.wtf-hardware.nix
|
|
|
|
];
|
|
|
|
}
|