summary refs log tree commit diff
path: root/pkgs/tools/graphics/xcolor/default.nix
blob: dabe14d895fa73a50b955a0113f6bc6a1f18f089 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ lib, rustPlatform, fetchFromGitHub, pkg-config, libX11, libXcursor
, libxcb, python3, installShellFiles, makeDesktopItem, copyDesktopItems }:

rustPlatform.buildRustPackage rec {
  pname = "xcolor";
  version = "0.5.1";

  src = fetchFromGitHub {
    owner = "Soft";
    repo = pname;
    rev = version;
    sha256 = "sha256-NfmoBZek4hsga6RflE5EKkWarhCFIcTwEXhg2fpkxNE=";
  };

  cargoSha256 = "sha256-Zh73+FJ63SkusSavCqSCLbHVnU++4ZFSMFUIM7TnOj0=";

  nativeBuildInputs = [ pkg-config python3 installShellFiles copyDesktopItems ];

  buildInputs = [ libX11 libXcursor libxcb ];

  desktopItems = [
    (makeDesktopItem {
      name = "XColor";
      exec = "xcolor -s";
      desktopName = "XColor";
      comment = "Select colors visible anywhere on the screen to get their RGB representation";
      icon = "xcolor";
      categories = [ "Graphics" ];
    })
  ];

  postInstall = ''
    mkdir -p $out/share/applications

    installManPage man/xcolor.1
    for x in 16 24 32 48 256 512; do
        install -D -m644 extra/icons/xcolor-''${x}.png $out/share/icons/hicolor/''${x}x''${x}/apps/xcolor.png
    done
  '';

  meta = with lib; {
    description = "Lightweight color picker for X11";
    homepage = "https://github.com/Soft/xcolor";
    maintainers = with lib.maintainers; [ moni ];
    license = licenses.mit;
  };
}