From 172d40f960e615399e37657b49a1598775adc200 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 22 Feb 2024 17:46:37 +0100 Subject: [PATCH] nfsroot: add reinstallDacbert command --- hosts/nfsroot/default.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/hosts/nfsroot/default.nix b/hosts/nfsroot/default.nix index b06f2a13..d41c5171 100644 --- a/hosts/nfsroot/default.nix +++ b/hosts/nfsroot/default.nix @@ -1,10 +1,29 @@ -{ lib, ... }: +{ config, lib, pkgs, ... }: let nfsExports = [ "var/lib/nfsroot/dacbert" "var/lib/nfsroot/riscbert" "var/lib/dump-dvb/whoopsie" ]; + + reinstallDacbert = pkgs.writeScriptBin "reinstall-dacbert" '' + SYSTEM=$(${pkgs.curl}/bin/curl -sLH "Accept: application/json" \ + https://hydra.hq.c3d2.de/job/c3d2/nix-config/dacbert/latest \ + | ${pkgs.jq}/bin/jq -er .buildoutputs.out.path + ) + BOOT=$(${pkgs.curl}/bin/curl -sLH "Accept: application/json" \ + https://hydra.hq.c3d2.de/job/c3d2/nix-config/dacbert-tftproot/latest \ + | ${pkgs.jq}/bin/jq -er .buildoutputs.out.path + ) + ${config.nix.package}/bin/nix --extra-experimental-features nix-command \ + copy \ + --from https://nix-cache.hq.c3d2.de \ + --to /var/lib/nfsroot/dacbert \ + --no-check-sigs \ + $SYSTEM $BOOT + cp /var/lib/nfsroot/dacbert/$BOOT/* /var/lib/nfsroot/dacbert/boot/ + ''; + in { imports = [ ./tftp.nix @@ -37,5 +56,7 @@ in { firewall.enable = false; }; + environment.systemPackages = [ reinstallDacbert ]; + system.stateVersion = "22.05"; }