{ pkgs, lib }: { palette, wallpaper, }: let str_pal = let inherit (lib) concatStringsSep; inherit (builtins) foldl' attrValues; in concatStringsSep " " ( foldl' (acc: el: acc ++ (attrValues el)) [ ] [ palette.normal palette.bright palette.util ] ); in pkgs.stdenv.mkDerivation { name = "generated-wallpaper.png"; src = wallpaper; buildInputs = [ pkgs.lutgen ]; phases = [ "installPhase" ]; installPhase = '' echo -e "Generating wallpaper from ${wallpaper} using palette:\n${str_pal}.." ${pkgs.lib.getExe pkgs.lutgen} apply --lum 0.8 -l 10 -s 128 -n 8 -o $out ${wallpaper} -- ${str_pal} ''; }