mirror of
https://codeberg.org/privacy1st/nix-git
synced 2025-01-22 06:35:44 +01:00
19 lines
743 B
Nix
19 lines
743 B
Nix
|
{ pkgs, lib }:
|
||
|
let
|
||
|
max-width = "256";
|
||
|
in
|
||
|
pkgs.stdenv.mkDerivation rec{
|
||
|
name = "yoda-profile-image";
|
||
|
src = "${../assets/img/profile-image/face.jpg}";
|
||
|
nativeBuildInputs = with pkgs; [ imagemagick ];
|
||
|
phases = "installPhase";
|
||
|
# magick limit width: https://stackoverflow.com/a/38415211/6334421
|
||
|
# magick jpg options: quality, progressive, strip metadata. https://stackoverflow.com/a/7262050/6334421
|
||
|
installPhase = ''
|
||
|
set -eu -o pipefail
|
||
|
mkdir -p $out
|
||
|
${pkgs.imagemagick}/bin/magick $src -resize '${max-width}>' -quality 90% -interlace Plane -strip $out/img.jpg
|
||
|
${pkgs.imagemagick}/bin/magick $src -resize '${max-width}>' $out/img.png
|
||
|
'';
|
||
|
}
|