realwallpaper: move pkgs into export

This commit is contained in:
lassulus 2021-04-27 21:40:35 +02:00
parent 9ae85f32e3
commit af6b58bc08
2 changed files with 19 additions and 13 deletions

View File

@ -42,15 +42,6 @@ let
description = "real wallpaper generator"; description = "real wallpaper generator";
after = [ "network.target" ]; after = [ "network.target" ];
path = with pkgs; [
xplanet
imagemagick
inkscape
curl
file
jq
];
environment = { environment = {
working_dir = cfg.workingDir; working_dir = cfg.workingDir;
marker_url = cfg.marker; marker_url = cfg.marker;

View File

@ -1,6 +1,21 @@
{ pkgs, ... }: { pkgs, ... }:
pkgs.writers.writeDashBin "generate-wallpaper" '' pkgs.writers.writeDashBin "generate-wallpaper" ''
set -euf set -xeuf
export PATH=${with pkgs; lib.makeBinPath [
coreutils
curl
gnugrep
gnused
file
findutils
grib2json
imagemagick
inkscape
jq
nomads-cloud
xplanet
]}
# usage: getimg FILENAME URL # usage: getimg FILENAME URL
fetch() { fetch() {
@ -118,7 +133,7 @@ pkgs.writers.writeDashBin "generate-wallpaper" ''
# fetch clouds if they are older than 3h # fetch clouds if they are older than 3h
if ! test "$(find clouds-raw.png -mmin -180)"; then if ! test "$(find clouds-raw.png -mmin -180)"; then
${pkgs.nomads-cloud}/bin/nomads-cloud clouds-raw.png nomads-cloud clouds-raw.png
fi fi
in_size=3600x1800 in_size=3600x1800
@ -161,14 +176,14 @@ pkgs.writers.writeDashBin "generate-wallpaper" ''
fi fi
if needs_rebuild krebs.png krebs-raw.svg; then if needs_rebuild krebs.png krebs-raw.svg; then
inkscape -z -e krebs.png -w 16 -h 16 krebs-raw.svg inkscape --export-type="png" --export-width=16 --export-height=16 --export-filename=krebs.png krebs-raw.svg
fi fi
# -- Planets -- # -- Planets --
for planet in mercury venus mars jupiter saturn uranus neptune; do for planet in mercury venus mars jupiter saturn uranus neptune; do
if needs_rebuild "$planet".png "$planet"-raw.svg; then if needs_rebuild "$planet".png "$planet"-raw.svg; then
sed -i 's/#000/#FE8019/g' "$planet"-raw.svg sed -i 's/#000/#FE8019/g' "$planet"-raw.svg
inkscape -z -e "$planet".png -w 40 -h 40 "$planet"-raw.svg inkscape --export-type="png" --export-width=40 --export-height=40 --export-filename="$planet.png" "$planet-raw.svg"
fi fi
done done