ops/nixos: whitby-distributed

This commit is contained in:
Luke Granger-Brown 2023-03-12 03:51:10 +00:00
parent c5d4542bbb
commit 6d24fe6e78
4 changed files with 44 additions and 19 deletions

View file

@ -47,6 +47,7 @@ in
imports = [ imports = [
../lib/zfs.nix ../lib/zfs.nix
../lib/bgp.nix ../lib/bgp.nix
../lib/whitby-distributed.nix
../lib/nixbuild-distributed.nix ../lib/nixbuild-distributed.nix
../lib/gitlab-runner-cacher.nix ../lib/gitlab-runner-cacher.nix
../lib/coredns/default.nix ../lib/coredns/default.nix

View file

@ -4,7 +4,7 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
imports = [ ./vault-agent-secrets.nix ]; imports = [ ./nixbuild-key.nix ];
# Distributed builds! # Distributed builds!
nix.buildMachines = lib.mkAfter [{ nix.buildMachines = lib.mkAfter [{
@ -27,22 +27,6 @@
builders-use-substitutes = true builders-use-substitutes = true
''; '';
my.vault.secrets.id_ed25519_nixbuild = {
group = "users";
template = ''
{{ with secret "kv/apps/nixbuild" -}}
{{ .Data.data.id_ed25519_nixbuild }}
{{- end }}
'';
};
my.vault.secrets."id_ed25519_nixbuild.pub" = {
group = "users";
template = ''
{{ with secret "kv/apps/nixbuild" -}}
{{ .Data.data.id_ed25519_nixbuild_pub }}
{{- end }}
'';
};
programs.ssh.extraConfig = '' programs.ssh.extraConfig = ''
Host eu.nixbuild.net Host eu.nixbuild.net
PubkeyAcceptedKeyTypes ssh-ed25519 PubkeyAcceptedKeyTypes ssh-ed25519

View file

@ -0,0 +1,25 @@
# SPDX-FileCopyrightText: 2023 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ config, lib, ... }:
{
imports = [ ./vault-agent-secrets.nix ];
my.vault.secrets.id_ed25519_nixbuild = {
group = "users";
template = ''
{{ with secret "kv/apps/nixbuild" -}}
{{ .Data.data.id_ed25519_nixbuild }}
{{- end }}
'';
};
my.vault.secrets."id_ed25519_nixbuild.pub" = {
group = "users";
template = ''
{{ with secret "kv/apps/nixbuild" -}}
{{ .Data.data.id_ed25519_nixbuild_pub }}
{{- end }}
'';
};
}

View file

@ -2,11 +2,13 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
{ lib, ... }: { lib, config, ... }:
{ {
imports = [ ./nixbuild-key.nix ];
# Distributed builds! # Distributed builds!
nix.buildMachines = lib.mkAfter [ { nix.buildMachines = lib.mkAfter [ {
hostName = "whitby"; hostName = "whitby-build";
system = "x86_64-linux"; system = "x86_64-linux";
maxJobs = 64; maxJobs = 64;
speedFactor = 4; speedFactor = 4;
@ -17,4 +19,17 @@
nix.extraOptions = '' nix.extraOptions = ''
builders-use-substitutes = true builders-use-substitutes = true
''; '';
programs.ssh.extraConfig = ''
Host whitby-build
User lukegb
PubkeyAcceptedKeyTypes ssh-ed25519
IdentityFile ${config.my.vault.secrets.id_ed25519_nixbuild.path}
'';
programs.ssh.knownHosts = {
whitby-build = {
hostNames = [ "whitby.tvl.fyi" "whitby-build" ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILNh/w4BSKov0jdz3gKBc98tpoLta5bb87fQXWBhAl2I";
};
};
} }