blob: 03cd541a35be27b17dfecde4518e4a66611d080f [file] [log] [blame]
Serge Bazanski6abe4fa2020-10-03 00:18:34 +02001# Top-level file aggregating all machines managed from hscloud.
2#
3# This allows to have a common attrset of machines that can be deployed
4# in the same way.
5#
6# Currently building/deployment is still done in a half-assed way:
7#
8# machine=edge01.waw.bgp.wtf
Serge Bazanskia0332a72021-03-17 22:12:43 +01009# d=$(nix-build -A 'ops.machines."'$machine'"'.toplevel)
Serge Bazanski6abe4fa2020-10-03 00:18:34 +020010#
Serge Bazanskia0332a72021-03-17 22:12:43 +010011# To then deploy derivation $d on $machine:
Serge Bazanski6abe4fa2020-10-03 00:18:34 +020012#
Serge Bazanski6abe4fa2020-10-03 00:18:34 +020013# nix-copy-closure --to root@$machine $d
14# ssh root@$machine $d/bin/switch-to-configuration
15#
16# TODO(q3k): merge this with //cluster/clustercfg - this should be unified!
17
18{ hscloud, pkgs, ... }:
19
20let
21 # Stopgap measure to import //cluster/nix machine definitions into new
22 # //ops/machines infrastructure.
23 # TODO(q3k): inject defs-cluster-k0.nix / defs-machines.nix content via
24 # nixos options instead of having module definitions loading it themselves,
25 # deduplicate list of machines below with defs-machines.nix somehow.
26 mkClusterMachine = name: pkgs.nixos ({ config, pkgs, ... }: {
27 # The hostname is used by //cluster/nix machinery to load the appropriate
28 # config from defs-machines into defs-cluster-k0.
29 networking.hostName = name;
30 imports = [
31 ../cluster/nix/modules/base.nix
32 ../cluster/nix/modules/kubernetes.nix
33 ];
34 });
35
Serge Bazanskia0332a72021-03-17 22:12:43 +010036 mkMachine = pkgs: paths: pkgs.nixos ({ config, pkgs, ... }: {
Serge Bazanski6abe4fa2020-10-03 00:18:34 +020037 imports = paths;
38 });
39
40in {
41 "bc01n01.hswaw.net" = mkClusterMachine "bc01n01";
42 "bc01n02.hswaw.net" = mkClusterMachine "bc01n02";
43 "bc01n03.hswaw.net" = mkClusterMachine "bc01n03";
44 "dcr01s22.hswaw.net" = mkClusterMachine "dcr01s22";
45 "dcr01s24.hswaw.net" = mkClusterMachine "dcr01s24";
46
Serge Bazanskia0332a72021-03-17 22:12:43 +010047 # edge01 still lives on an old nixpkgs checkout.
48 # TODO(b/3): unpin and deploy.
49 "edge01.waw.bgp.wtf" = mkMachine (
50 import (pkgs.fetchFromGitHub {
51 owner = "nixos";
52 repo = "nixpkgs-channels";
53 rev = "c59ea8b8a0e7f927e7291c14ea6cd1bd3a16ff38";
54 sha256 = "1ak7jqx94fjhc68xh1lh35kh3w3ndbadprrb762qgvcfb8351x8v";
55 }) {}
56 ) [
Serge Bazanski6abe4fa2020-10-03 00:18:34 +020057 ../bgpwtf/machines/edge01.waw.bgp.wtf.nix
58 ../bgpwtf/machines/edge01.waw.bgp.wtf-hardware.nix
59 ];
60}