mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 19:12:11 +02:00
Update
This commit is contained in:
31
hosts/modules/server/bitcoin-git.nix
Normal file
31
hosts/modules/server/bitcoin-git.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
systemd.timers."bitcoin-git" = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
Unit = "bitcoin-git.service";
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services."bitcoin-git" = {
|
||||
script = ''
|
||||
[ ! -d "/home/heaven/btcprice" ] && git clone git@github.com:anotherhadi/btcprice /home/heaven/btcprice
|
||||
cd "/home/heaven/btcprice"
|
||||
price=$(curl eur.rate.sx/1BTC)
|
||||
echo "# Bitcoin Price in EURO" >README.md
|
||||
echo "" >>README.md
|
||||
echo "1 Bitcoin = $price€" >>README.md
|
||||
echo "" >>README.md
|
||||
echo "Date: $(date)" >>README.md
|
||||
git add .
|
||||
git commit -m "Update price (heaven)"
|
||||
git push -u origin main
|
||||
exit 0
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "heaven";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user