Compare commits

...

2 Commits

2 changed files with 43 additions and 0 deletions

View File

@ -29,6 +29,12 @@
hostNames = [ "zw.poelzi.org" ];
proxyTo.host = "172.20.73.162";
matchArg = "-m end";
} {
hostNames = [ "borken.dvb.solutions" "borken.tlm.solutions" ];
proxyTo = {
host = hostRegistry.borken-data-hoarder.ip4;
};
matchArg = "-m end";
} {
hostNames = [ "staging.dvb.solutions" "staging.tlm.solutions" ];
proxyTo = {

View File

@ -2,7 +2,42 @@
let
microvms = {
staging-data-hoarder.flakeref = "git+https://github.com/tlm-solutions/nix-config";
borken-data-hoarder.flakeref = "git+file:///tmp/dump-dvb-borken";
};
realizeFlake = with pkgs; "${writeScriptBin "realize-flake" ''
#! ${runtimeShell} -e
NAME=$1
if [ $NAME = "borken-data-hoarder" ]; then
SRC_NIX_CONFIG=https://github.com/dump-dvb/nix-config.git
BRANCH=borken
DIR_NIX_CONFIG=dump-dvb-borken
elif [ $NAME = "staging-data-hoarder" ]; then
echo "staging-data-hoarder: no need for flake magic"
echo "Deploying staging-data-hoarder from github"
exit 0
else
echo "Do not know what to do"
exit 0
fi
cd /tmp
if [ -d $DIR_DUMP_DVB ]; then
cd $DIR_NIX_CONFG
git fetch origin
git reset --hard origin/$BRANCH
else
git clone -b $BRANCH --single-branch $SRC_NIX_CONFIG $DIR_NIX_CONFIG
cd $DIR_NIX_CONFIG
fi
git config user.email "grisha@tlm.solutions"
git config user.name "Flake McUpdater"
nix flake update --commit-lock-file
''}/bin/realize-flake";
in
{
microvm.autostart = builtins.attrNames microvms;
@ -21,6 +56,7 @@ in
scriptArgs = "%i";
script = ''
NAME=$1
${realizeFlake} $NAME
/run/current-system/sw/bin/microvm -Ru $NAME
'';
};
@ -44,6 +80,7 @@ in
'';
};
}) {} (builtins.attrNames microvms);
${realizeFlake} ${name}
systemd.timers = builtins.foldl' (timers: name: timers // {
"microvm-update-${name}" = {