data-hoarder-staging: deploy from master
This commit is contained in:
parent
967d833586
commit
9772890f59
|
@ -1,50 +1,8 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
microvms = {
|
microvms = {
|
||||||
staging-data-hoarder.flakeref = "git+file:///tmp/dvb-nix-config";
|
staging-data-hoarder.flakeref = "git+https://github.com/tlm-solutions/nix-config";
|
||||||
};
|
};
|
||||||
|
|
||||||
realizeFlake = with pkgs; "${writeScriptBin "realize-flake" ''
|
|
||||||
#! ${runtimeShell} -e
|
|
||||||
|
|
||||||
NAME=$1
|
|
||||||
if [ $NAME = "staging-data-hoarder" ]; then
|
|
||||||
SRC_NIX_CONFIG=https://github.com/dump-dvb/nix-config.git
|
|
||||||
SRC_DUMP_DVB=https://github.com/dump-dvb/dump-dvb.nix.git
|
|
||||||
BRANCH=master
|
|
||||||
|
|
||||||
DIR_NIX_CONFIG=dvb-nix-config
|
|
||||||
DIR_DUMP_DVB=dvb-dump
|
|
||||||
else
|
|
||||||
echo "Do not know what to do"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd /tmp
|
|
||||||
if [ -d $DIR_DUMP_DVB ]; then
|
|
||||||
cd $DIR_DUMP_DVB
|
|
||||||
git fetch origin
|
|
||||||
git reset --hard origin/$BRANCH
|
|
||||||
else
|
|
||||||
git clone -b $BRANCH --single-branch $SRC_DUMP_DVB $DIR_DUMP_DVB
|
|
||||||
cd $DIR_DUMP_DVB
|
|
||||||
fi
|
|
||||||
git config --global user.email "astro@spaceboyz.net"
|
|
||||||
git config --global user.name "Updater"
|
|
||||||
nix flake update --commit-lock-file
|
|
||||||
|
|
||||||
cd /tmp
|
|
||||||
if [ -d $DIR_NIX_CONFIG ]; then
|
|
||||||
cd $DIR_NIX_CONFIG
|
|
||||||
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
|
|
||||||
|
|
||||||
nix flake update --commit-lock-file --override-input dump-dvb /tmp/$DIR_DUMP_DVB
|
|
||||||
''}/bin/realize-flake";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
microvm.autostart = builtins.attrNames microvms;
|
microvm.autostart = builtins.attrNames microvms;
|
||||||
|
@ -63,7 +21,6 @@ in
|
||||||
scriptArgs = "%i";
|
scriptArgs = "%i";
|
||||||
script = ''
|
script = ''
|
||||||
NAME=$1
|
NAME=$1
|
||||||
${realizeFlake} $NAME
|
|
||||||
/run/current-system/sw/bin/microvm -Ru $NAME
|
/run/current-system/sw/bin/microvm -Ru $NAME
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -83,8 +40,6 @@ in
|
||||||
environment.HOME = config.users.users.root.home;
|
environment.HOME = config.users.users.root.home;
|
||||||
scriptArgs = "${name}";
|
scriptArgs = "${name}";
|
||||||
script = ''
|
script = ''
|
||||||
${realizeFlake} ${name}
|
|
||||||
|
|
||||||
/run/current-system/sw/bin/microvm -c ${name} -f "${microvms.${name}.flakeref}"
|
/run/current-system/sw/bin/microvm -c ${name} -f "${microvms.${name}.flakeref}"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue