From f76d0b3c8a73f5ddb47375fbee718c39d1563310 Mon Sep 17 00:00:00 2001 From: Wolfgang Date: Sat, 26 Oct 2024 13:00:09 +0200 Subject: [PATCH] Use the path option in systemd instead of repeating pkgs --- nixos/modules/services/misc/duckdns.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/misc/duckdns.nix b/nixos/modules/services/misc/duckdns.nix index 1c5a6b6971752..ff3d411569663 100644 --- a/nixos/modules/services/misc/duckdns.nix +++ b/nixos/modules/services/misc/duckdns.nix @@ -49,6 +49,11 @@ in after = [ "network.target" ]; wantedBy = [ "multi-user.target" ]; startAt = "*:0/5"; + path = [ + pkgs.gnused + pkgs.systemd + pkgs.curl + ]; serviceConfig = { Type = "simple"; LoadCredential = [ @@ -57,14 +62,14 @@ in DynamicUser = true; }; script = '' - export DUCKDNS_TOKEN=$(${pkgs.systemd}/bin/systemd-creds cat DUCKDNS_TOKEN_FILE) + export DUCKDNS_TOKEN=$(systemd-creds cat DUCKDNS_TOKEN_FILE) ${lib.optionalString (cfg.domains != null) '' export DUCKDNS_DOMAINS='${lib.strings.concatStringsSep "," cfg.domains}' ''} ${lib.optionalString (cfg.domainsFile != null) '' - export DUCKDNS_DOMAINS=$(${pkgs.systemd}/bin/systemd-creds cat DUCKDNS_DOMAINS_FILE | ${pkgs.gnused}/bin/sed -z 's/\n/,/g') + export DUCKDNS_DOMAINS=$(systemd-creds cat DUCKDNS_DOMAINS_FILE | sed -z 's/\n/,/g') ''} - ${pkgs.curl}/bin/curl --no-progress-meter -k "https://www.duckdns.org/update?domains=$DUCKDNS_DOMAINS&token=$DUCKDNS_TOKEN&ip=" | grep -v "KO" + curl --no-progress-meter -k "https://www.duckdns.org/update?domains=$DUCKDNS_DOMAINS&token=$DUCKDNS_TOKEN&ip=" | grep -v "KO" ''; }; };