diff --git a/configuration.nix b/configuration.nix index 249062b..8be526b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -81,7 +81,7 @@ let read_api_key_file /etc/nasa-api.env fi if [ -z "$api_key" ]; then - api_key="DEMO_KEY" + exit 0 fi today="$(date +%F)" @@ -400,6 +400,7 @@ in description = "Fetch NASA APOD wallpaper for greetd"; after = [ "network-online.target" ]; wants = [ "network-online.target" ]; + restartIfChanged = false; serviceConfig = { Type = "oneshot"; ExecStart = "${fetchGreetdApod}/bin/greetd-apod-wallpaper"; @@ -411,9 +412,9 @@ in systemd.timers.greetd-apod-wallpaper = { wantedBy = [ "timers.target" ]; timerConfig = { - OnBootSec = "30s"; - OnCalendar = "hourly"; - Persistent = true; + OnActiveSec = "2m"; + OnUnitActiveSec = "1h"; + Persistent = false; Unit = "greetd-apod-wallpaper.service"; }; }; diff --git a/home-modules/lib.nix b/home-modules/lib.nix index be210ee..a7d5738 100644 --- a/home-modules/lib.nix +++ b/home-modules/lib.nix @@ -174,7 +174,7 @@ let read_api_key_file "''${NASA_API_KEY_FILE:-${config.home.homeDirectory}/.config/nasa-api.env}" fi if [ -z "$api_key" ]; then - api_key="DEMO_KEY" + exit 0 fi api_curl_args=( diff --git a/home-modules/sway.nix b/home-modules/sway.nix index 5692b60..1ab3ddd 100644 --- a/home-modules/sway.nix +++ b/home-modules/sway.nix @@ -292,6 +292,7 @@ in Description = "Fetch NASA APOD wallpaper"; After = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ]; + X-RestartIfChanged = false; }; Service = { Type = "oneshot"; @@ -304,9 +305,9 @@ in systemd.user.timers.nasa-apod-wallpaper = { Unit.Description = "Refresh NASA APOD wallpaper regularly"; Timer = { - OnStartupSec = "2m"; - OnCalendar = "hourly"; - Persistent = true; + OnActiveSec = "2m"; + OnUnitActiveSec = "1h"; + Persistent = false; Unit = "nasa-apod-wallpaper.service"; }; Install.WantedBy = [ "timers.target" ];