summary refs log tree commit diff
path: root/pkgs/os-specific/linux/pommed-light/default.nix
blob: 0797656f653e99af613a241ce276e5aae8c2cebf (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
58
59
60
61
62
63
64
65
{ lib, stdenv
, fetchFromGitHub
, pciutils
, libconfuse
, alsa-lib
, audiofile
, pkg-config
, zlib
, eject
}:

stdenv.mkDerivation rec {
  pkgname = "pommed-light";
  version = "1.51lw";
  name = "${pkgname}-${version}";

  src = fetchFromGitHub {
    owner = "bytbox";
    repo = pkgname;
    rev = "v${version}";
    sha256 = "18fvdwwhcl6s4bpf2f2i389s71c8k4g0yb81am9rdddqmzaw27iy";
  };

  postPatch = ''
    substituteInPlace pommed.conf.mactel --replace /usr $out
    substituteInPlace pommed.conf.pmac --replace /usr $out
    substituteInPlace pommed/beep.h --replace /usr $out
    substituteInPlace pommed/cd_eject.c --replace /usr/bin/eject ${eject}/bin/eject
  '';

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [
    pciutils
    libconfuse
    alsa-lib
    audiofile
    zlib
    eject
  ];

  installPhase = ''
    install -Dm755 pommed/pommed $out/bin/pommed
    install -Dm644 pommed.conf.mactel $out/etc/pommed.conf.mactel
    install -Dm644 pommed.conf.pmac $out/etc/pommed.conf.pmac

    # Man page
    install -Dm644 pommed.1 $out/share/man/man1/pommed.1

    # Sounds
    install -Dm644 pommed/data/goutte.wav $out/share/pommed/goutte.wav
    install -Dm644 pommed/data/click.wav $out/share/pommed/click.wav
  '';

  meta = {
    description = "A trimmed version of the pommed hotkey handler for MacBooks";
    longDescription = ''
      This is a stripped-down version of pommed with client, dbus, and
      ambient light sensor support removed, optimized for use with dwm
      and the like.
    '';
    homepage = "https://github.com/bytbox/pommed-light";
    platforms = [ "x86_64-linux" ];
    license = lib.licenses.gpl2;
  };
}