Backup Chaospott markdown

This commit is contained in:
Ingolf Wagner 2023-10-20 08:01:09 +02:00
parent c1bcacb7c0
commit a20f9fe608
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 47 additions and 0 deletions

View file

@ -30,6 +30,7 @@
./media-jellyfin.nix
./media-youtube.nix
./media-castget.nix
./media-curl.nix
# logging
./loki.nix

View file

@ -0,0 +1,45 @@
{ config, pkgs, lib, ... }:
with lib;
let
configuration = {
Chaospott37C3Tickets = {
url = "https://md.chaospott.de/171s8-_cQCyX_tUca_Jxqw/download";
target = "/media/curl/37C3";
output = "$( date +%H:%M:%S )-TicketPlaning.md";
};
};
downloadScript =
name: { url
, target
, output
}: pkgs.writers.writeDash "curl-script-${name}" ''
mkdir -p "${target}"
curl "${url}" -o "${target}/${output}"
'';
in
{
systemd.services.curl-download = {
after = [ "network.target" ];
path = [ pkgs.curl ];
serviceConfig = {
User = "media";
Group = "media";
};
script = (concatStringsSep "\n"
(mapAttrsToList downloadScript configuration)
);
};
systemd.timers.curl-download = {
enable = true;
wantedBy = [ "multi-user.target" ];
timerConfig = {
OnCalendar = "hourly";
Persistent = "true";
};
};
}

View file

@ -27,6 +27,7 @@
set -e
${pkgs.psmisc}/bin/killall gpg-agent
rm -r ~/.gnupg/private-keys-v1.d/
${pkgs.gnupg}/bin/gpg --card-status
echo "now the new key should work"
'')