fix(ops/deploy-machine): drop

This doesn't look like it's actually being used.

Change-Id: I06e15d01b793748d9ed216b23b95a757bc2d0f0e
This commit is contained in:
Florian Klink 2025-03-16 14:12:02 +01:00
parent dcbe231825
commit 9ac1b9a798
5 changed files with 6 additions and 95 deletions

View file

@ -1,31 +0,0 @@
{ pkgs, ... }:
pkgs.stdenv.mkDerivation {
name = "deploy-machine";
phases = [ "installPhase" "installCheckPhase" ];
nativeBuildInputs = with pkgs; [
makeWrapper
];
installPhase = ''
mkdir -p $out/bin
makeWrapper ${./deploy-machine.sh} $out/bin/deploy-machine.sh \
--prefix PATH : ${with pkgs; lib.makeBinPath [
ansi2html
git
jq
nvd
]}
'';
installCheckInputs = with pkgs; [
shellcheck
];
doInstallCheck = true;
installCheckPhase = ''
shellcheck $out/bin/deploy-machine.sh
'';
}

View file

@ -1,52 +0,0 @@
#!/usr/bin/env bash
set -Ceuo pipefail
DOMAIN="snix.dev"
FORGE_URL="cl.snix.dev"
REPO="tvix"
TARGET_SYSTEM="gerrit01"
TARGET_IRC_CHANNEL="#tvix-dev"
HTML_ROOT="${HTML_ROOT:-/var/html/deploys."$DOMAIN"}"
URL_BASE="${URL_BASE:-https://deploys."$DOMAIN"/diff}"
IRCCAT_PORT="${IRCCAT_PORT:-4722}"
drv_hash() {
basename "$1" | sed 's/-.*//'
}
new_rev="$1"
if [ -z "$new_rev" ]; then
>&2 echo "Usage: $0 <new_rev>"
exit 1
fi
if [ -d "/tmp/deploy.worktree" ]; then
>&2 echo "/tmp/deploy.worktree exists - exiting in case another deploy is currently running"
exit 1
fi
worktree_dir=/tmp/worktree_dir
cleanup() {
rm -rf "$worktree_dir"
}
trap cleanup EXIT
git clone https://"$FORGE_URL"/"$REPO" "$worktree_dir" --reference /"$REPO"
git -C "$worktree_dir" checkout "$new_rev"
current=$(nix show-derivation /run/current-system | jq -r 'keys | .[0]')
new=$(nix-instantiate -A ops.nixos."$TARGET_SYSTEM" "$worktree_dir")
diff_filename="$(drv_hash "$current")..$(drv_hash "$new").html"
nvd --color always diff "$current" "$new" \
| ansi2html \
>| "$HTML_ROOT/diff/$diff_filename"
chmod a+r "$HTML_ROOT/diff/$diff_filename"
echo "$TARGET_IRC_CHANNEL $TARGET_SYSTEM is being deployed! system diff: $URL_BASE/$diff_filename" \
| nc -w 5 -N localhost "$IRCCAT_PORT"
# TODO(grfn): Actually do the deploy

View file

@ -80,7 +80,7 @@ in
services.fail2ban.enable = true; services.fail2ban.enable = true;
environment.systemPackages = (with pkgs; [ environment.systemPackages = with pkgs; [
bat bat
bb bb
curl curl
@ -96,9 +96,7 @@ in
tree tree
unzip unzip
vim vim
]) ++ (with depot; [ ];
ops.deploy-machine
]);
# Required for prometheus to be able to scrape stats # Required for prometheus to be able to scrape stats
services.nginx.statusPage = true; services.nginx.statusPage = true;

View file

@ -111,7 +111,7 @@ in
services.fail2ban.enable = true; services.fail2ban.enable = true;
environment.systemPackages = (with pkgs; [ environment.systemPackages = with pkgs; [
bat bat
bb bb
curl curl
@ -127,9 +127,7 @@ in
tree tree
unzip unzip
vim vim
]) ++ (with depot; [ ];
ops.deploy-machine
]);
# Required for prometheus to be able to scrape stats # Required for prometheus to be able to scrape stats
services.nginx.statusPage = true; services.nginx.statusPage = true;

View file

@ -172,7 +172,7 @@ in
services.fail2ban.enable = true; services.fail2ban.enable = true;
environment.systemPackages = (with pkgs; [ environment.systemPackages = with pkgs; [
bat bat
bb bb
curl curl
@ -188,9 +188,7 @@ in
tree tree
unzip unzip
vim vim
]) ++ (with depot; [ ];
ops.deploy-machine
]);
# Required for prometheus to be able to scrape stats # Required for prometheus to be able to scrape stats
services.nginx.statusPage = true; services.nginx.statusPage = true;