summary refs log tree commit diff
path: root/pkgs/os-specific/darwin/khd/default.nix
blob: 0e5d466e16ad4b959b697ae32d5096a066ed695d (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
{ stdenv, fetchFromGitHub, Carbon, Cocoa }:

stdenv.mkDerivation rec {
  name = "khd-${version}";
  version = "2.0.0";

  src = fetchFromGitHub {
    owner = "koekeishiya";
    repo = "khd";
    rev = "v${version}";
    sha256 = "02v2bq095h1ylx700kayakg7f9p43vrz6p9ry3g7lq37s6apgm8h";
  };

  buildInputs = [ Carbon Cocoa ];

  prePatch = ''
    substituteInPlace makefile \
      --replace g++ clang++
  '';

  buildPhase = ''
    make install
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp bin/khd $out/bin/khd

    mkdir -p $out/Library/LaunchDaemons
    cp ${./org.nixos.khd.plist} $out/Library/LaunchDaemons/org.nixos.khd.plist
    substituteInPlace $out/Library/LaunchDaemons/org.nixos.khd.plist --subst-var out
  '';

  meta = with stdenv.lib; {
    description = "A simple modal hototkey daemon for OSX";
    homepage = https://github.com/koekeishiya/khd;
    downloadPage = https://github.com/koekeishiya/khd/releases;
    platforms = platforms.darwin;
    maintainers = with maintainers; [ lnl7 ];
    license = licenses.mit;
  };
}