xcolor: unstable -> 0.5.0 (#134937)

* xcolor: unstable -> 0.5.0

Also create a desktop item so xcolor shows up in application launchers.

* xcolor: cleanup install phase

Use available utility functions for installing man pages and desktop items. Also
cleanup redundant icon copy lines.

authored by Bart Bakker and committed by GitHub 2f2c1a90 396b561e

+26 -13
+26 -13
pkgs/tools/graphics/xcolor/default.nix
··· 1 - { lib, rustPlatform, fetchFromGitHub, fetchpatch, pkg-config, libX11, libXcursor, libxcb, python3 }: 1 + { lib, rustPlatform, fetchFromGitHub, pkg-config, libX11, libXcursor 2 + , libxcb, python3, installShellFiles, makeDesktopItem, copyDesktopItems }: 2 3 3 4 rustPlatform.buildRustPackage rec { 4 5 pname = "xcolor"; 5 - version = "unstable-2021-02-02"; 6 + version = "0.5.0"; 6 7 7 8 src = fetchFromGitHub { 8 9 owner = "Soft"; 9 10 repo = pname; 10 - rev = "0e99e67cd37000bf563aa1e89faae796ec25f163"; 11 - sha256 = "sha256-rHqK05dN5lrvDNbRCWGghI7KJwWzNCuRDEThEeMzmio="; 11 + rev = version; 12 + sha256 = "0i04jwvjasrypnsfwdnvsvcygp8ckf1a5sxvjxaivy73cdvy34vk"; 12 13 }; 13 14 14 - cargoPatches = [ 15 - # Update Cargo.lock, lexical_core doesn't build on Rust 1.52.1 16 - (fetchpatch { 17 - url = "https://github.com/Soft/xcolor/commit/324d80a18a39a11f2f7141b226f492e2a862d2ce.patch"; 18 - sha256 = "sha256-5VzXitpl/gMef40UQBh1EoHezXPyB08aflqp0mSMAVI="; 15 + cargoSha256 = "1r2s4iy5ls0svw5ww51m37jhrbvnj690ig6n9c60hzw1hl4krk30"; 16 + 17 + nativeBuildInputs = [ pkg-config python3 installShellFiles copyDesktopItems ]; 18 + 19 + buildInputs = [ libX11 libXcursor libxcb ]; 20 + 21 + desktopItems = [ 22 + (makeDesktopItem { 23 + name = "XColor"; 24 + exec = "xcolor -s"; 25 + desktopName = "XColor"; 26 + comment = "Select colors visible anywhere on the screen to get their RGB representation"; 27 + icon = "xcolor"; 28 + categories = "Graphics;"; 19 29 }) 20 30 ]; 21 31 22 - cargoSha256 = "sha256-yD4pX+dCJvbDecsdB8tNt1VsEcyAJxNrB5WsZUhPGII="; 32 + postInstall = '' 33 + mkdir -p $out/share/applications 23 34 24 - nativeBuildInputs = [ pkg-config python3 ]; 25 - 26 - buildInputs = [ libX11 libXcursor libxcb ]; 35 + installManPage man/xcolor.1 36 + for x in 16 24 32 48 256 512; do 37 + install -D -m644 extra/icons/xcolor-''${x}.png $out/share/icons/hicolor/''${x}x''${x}/apps/xcolor.png 38 + done 39 + ''; 27 40 28 41 meta = with lib; { 29 42 description = "Lightweight color picker for X11";