{ stdenv, imagemagick, gawk, src, }: stdenv.mkDerivation { pname = "invert-image-avg"; version = "1.0"; inherit src; buildInputs = [ imagemagick gawk ]; # input is a file, not a directory, skip unpackPhase unpackPhase = "true"; # command taken from: https://old.reddit.com/r/swaywm/comments/oz3t7v/setting_a_blurred_background_with_swaylock_and/ buildPhase = '' rm -fr $out magick ${src} -channel RGB -negate -resize 1x1 txt: | awk 'FNR == 2 {print $3}' > $out ''; }