getexe
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ lib, pkgs, ... }:
|
||||
{ lib, pkgs, namespace, ... }:
|
||||
with lib;
|
||||
let
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
|
||||
@@ -37,11 +37,11 @@ let
|
||||
ln -sf "$IMG_PATH" /run/wallpaper.jpg
|
||||
|
||||
# Try to download new wallpaper
|
||||
if ${pkgs.curl}/bin/curl -s --connect-timeout 5 --max-time 10 "https://www.bing.com" > /dev/null; then
|
||||
URL=$(${pkgs.curl}/bin/curl -s "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1" | \
|
||||
${pkgs.jq}/bin/jq -r '.images[0].url')
|
||||
if ${lib.getExe pkgs.curl} -s --connect-timeout 5 --max-time 10 "https://www.bing.com" > /dev/null; then
|
||||
URL=$(${lib.getExe pkgs.curl} -s "https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1" | \
|
||||
${lib.getExe pkgs.jq} -r '.images[0].url')
|
||||
FULL_URL="https://www.bing.com$URL"
|
||||
if ${pkgs.curl}/bin/curl -s -o "$IMG_PATH.tmp" "$FULL_URL"; then
|
||||
if ${lib.getExe pkgs.curl} -s -o "$IMG_PATH.tmp" "$FULL_URL"; then
|
||||
mv "$IMG_PATH.tmp" "$IMG_PATH"
|
||||
echo "Downloaded $FULL_URL to $IMG_PATH successfully"
|
||||
else
|
||||
@@ -73,10 +73,10 @@ let
|
||||
ln -sf "$IMG_PATH" /run/wallpaper.jpg
|
||||
|
||||
# Try to download new wallpaper
|
||||
if ${pkgs.curl}/bin/curl -s --connect-timeout 5 --max-time 10 "https://api.nasa.gov" > /dev/null; then
|
||||
if ${lib.getExe pkgs.curl} -s --connect-timeout 5 --max-time 10 "https://api.nasa.gov" > /dev/null; then
|
||||
APOD_URL="https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY"
|
||||
IMAGE_URL=$(${pkgs.curl}/bin/curl -s "$APOD_URL" | ${pkgs.jq}/bin/jq -r '.hdurl // .url')
|
||||
if ${pkgs.curl}/bin/curl -s -o "$IMG_PATH.tmp" "$IMAGE_URL"; then
|
||||
IMAGE_URL=$(${lib.getExe pkgs.curl} -s "$APOD_URL" | ${lib.getExe pkgs.jq} -r '.hdurl // .url')
|
||||
if ${lib.getExe pkgs.curl} -s -o "$IMG_PATH.tmp" "$IMAGE_URL"; then
|
||||
mv "$IMG_PATH.tmp" "$IMG_PATH"
|
||||
echo "Downloaded $IMAGE_URL to $IMG_PATH successfully"
|
||||
else
|
||||
@@ -149,7 +149,7 @@ in
|
||||
];
|
||||
script = ''
|
||||
${wallpaper-command}
|
||||
${pkgs.hyprland}/bin/hyprctl hyprpaper reload ,${cfg.wallpaper}
|
||||
${lib.getExe' pkgs.hyprland "hyprctl"} hyprpaper reload ,${cfg.wallpaper}
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
|
||||
Reference in New Issue
Block a user