about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/farge/default.nix
blob: 1abffc64e0263b1bf736aafc091180bed2ee08b3 (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
48
49
50
51
52
53
54
55
56
57
{ lib
, stdenv
, fetchFromGitHub
, makeBinaryWrapper
, bc
, libnotify
, feh
, grim
, imagemagick
, slurp
, wl-clipboard
, xcolor
, waylandSupport ? true
, x11Support ? true
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "farge";
  version = "1.0.9";

  src = fetchFromGitHub {
    owner = "sdushantha";
    repo = "farge";
    rev = "2ff6669e2350644d4f0b1bd84526efe5eae3c302";
    hash = "sha256-vCMuFMGcI4D4EzbSsXeNGKNS6nBFkfTcAmSzb9UMArc=";
  };

  nativeBuildInputs = [ makeBinaryWrapper ];

  # Ensure the following programs are found within $PATH
  wrapperPath = lib.makeBinPath ([
    bc
    feh
    #Needed to fix convert: unable to read font `(null)' @ error/annotate.c/RenderFreetype issue
    (imagemagick.override { ghostscriptSupport = true;})
    libnotify #Needed for the notify-send function call from the script
  ] ++ lib.optionals waylandSupport [ grim slurp wl-clipboard ]
    ++ lib.optionals x11Support [ xcolor ]);

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    install -m755 farge $out/bin
    wrapProgram $out/bin/farge \
        --prefix PATH : "${finalAttrs.wrapperPath}"
    runHook postInstall
  '';

  meta = with lib; {
    description = "A tool that shows the color value of a given pixel on your screen";
    homepage = "https://github.com/sdushantha/farge";
    license = licenses.mit;
    platforms = platforms.all;
    maintainers = with maintainers; [ jtbx justinlime ];
    mainProgram = "farge";
  };
})