From a20f9fe608b8e0acd2e819e2ce46864bcd687716 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 20 Oct 2023 08:01:09 +0200 Subject: [PATCH] Backup Chaospott markdown --- nixos/machines/chungus/configuration.nix | 1 + nixos/machines/chungus/media-curl.nix | 45 ++++++++++++++++++++++++ nixos/system/desktop/yubikey.nix | 1 + 3 files changed, 47 insertions(+) create mode 100644 nixos/machines/chungus/media-curl.nix diff --git a/nixos/machines/chungus/configuration.nix b/nixos/machines/chungus/configuration.nix index 4fec02e..3fc3205 100644 --- a/nixos/machines/chungus/configuration.nix +++ b/nixos/machines/chungus/configuration.nix @@ -30,6 +30,7 @@ ./media-jellyfin.nix ./media-youtube.nix ./media-castget.nix + ./media-curl.nix # logging ./loki.nix diff --git a/nixos/machines/chungus/media-curl.nix b/nixos/machines/chungus/media-curl.nix new file mode 100644 index 0000000..654d22a --- /dev/null +++ b/nixos/machines/chungus/media-curl.nix @@ -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"; + }; + }; + +} diff --git a/nixos/system/desktop/yubikey.nix b/nixos/system/desktop/yubikey.nix index 7eefefc..4f6bf0e 100644 --- a/nixos/system/desktop/yubikey.nix +++ b/nixos/system/desktop/yubikey.nix @@ -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" '')