aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/desktops/pantheon/services/elementary-dpms-helper/default.nix
blob: 3bb68475096f79beb3da0f7370e6c617a86c78bd (plain)
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
66
{ stdenv
, fetchFromGitHub
, nix-update-script
, pantheon
, meson
, ninja
, desktop-file-utils
, glib
, coreutils
, elementary-settings-daemon
, wrapGAppsHook
}:

stdenv.mkDerivation rec {
  pname = "elementary-dpms-helper";
  version = "1.0";

  repoName = "dpms-helper";

  src = fetchFromGitHub {
    owner = "elementary";
    repo = repoName;
    rev = version;
    sha256 = "sha256-0KbfAxvZ+aFjq+XEK4uoRHSyKlaky0FlJd2a5TG4bms=";
  };

  passthru = {
    updateScript = nix-update-script {
      attrPath = "pantheon.${pname}";
    };
  };

  nativeBuildInputs = [
    desktop-file-utils
    meson
    ninja
    wrapGAppsHook
  ];

  buildInputs = [
    elementary-settings-daemon
    glib
  ];

  preFixup = ''
    gappsWrapperArgs+=(--prefix PATH : "${stdenv.lib.makeBinPath [ glib.dev coreutils ]}")
  '';

  postFixup = ''
    substituteInPlace $out/etc/xdg/autostart/io.elementary.dpms-helper.desktop \
      --replace "Exec=io.elementary.dpms-helper" "Exec=$out/bin/io.elementary.dpms-helper"
  '';

  # See: https://github.com/elementary/dpms-helper/pull/10
  postInstall = ''
    ${glib.dev}/bin/glib-compile-schemas $out/share/glib-2.0/schemas
  '';

  meta = with stdenv.lib; {
    description = "Sets DPMS settings found in org.pantheon.dpms";
    homepage = "https://github.com/elementary/dpms-helper";
    license = licenses.gpl2;
    platforms = platforms.linux;
    maintainers = pantheon.maintainers;
  };
}