1 { lib, stdenv, fetchFromGitHub, fetchFromGitLab
2 , autoconf, automake, gettext, intltool
3 , libtool, pkg-config, wrapGAppsHook3, wrapPython, gobject-introspection, wayland-scanner
4 , gtk3, python, pygobject3, pyxdg
6 , withQuartz ? stdenv.hostPlatform.isDarwin, ApplicationServices
7 , withRandr ? stdenv.hostPlatform.isLinux, libxcb
8 , withDrm ? stdenv.hostPlatform.isLinux, libdrm
9 , withVidmode ? stdenv.hostPlatform.isLinux, libXxf86vm
11 , withGeolocation ? true
12 , withCoreLocation ? withGeolocation && stdenv.hostPlatform.isDarwin, CoreLocation, Foundation, Cocoa
13 , withGeoclue ? withGeolocation && stdenv.hostPlatform.isLinux, geoclue
14 , withAppIndicator ? stdenv.hostPlatform.isLinux, libappindicator, libayatana-appindicator
19 { pname, version, src, meta }:
20 stdenv.mkDerivation rec {
21 inherit pname version src meta;
23 patches = lib.optionals (pname != "gammastep") [
24 # https://github.com/jonls/redshift/pull/575
30 depsBuildBuild = [ pkg-config ];
43 ] ++ lib.optionals (pname == "gammastep") [ wayland-scanner ];
46 "--enable-randr=${if withRandr then "yes" else "no"}"
47 "--enable-geoclue2=${if withGeoclue then "yes" else "no"}"
48 "--enable-drm=${if withDrm then "yes" else "no"}"
49 "--enable-vidmode=${if withVidmode then "yes" else "no"}"
50 "--enable-quartz=${if withQuartz then "yes" else "no"}"
51 "--enable-corelocation=${if withCoreLocation then "yes" else "no"}"
52 ] ++ lib.optionals (pname == "gammastep") [
53 "--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user/"
59 ] ++ lib.optional withRandr libxcb
60 ++ lib.optional withGeoclue geoclue
61 ++ lib.optional withDrm libdrm
62 ++ lib.optional withVidmode libXxf86vm
63 ++ lib.optional withQuartz ApplicationServices
64 ++ lib.optionals withCoreLocation [ CoreLocation Foundation Cocoa ]
65 ++ lib.optional withAppIndicator (if (pname != "gammastep")
67 else libayatana-appindicator)
70 pythonPath = [ pygobject3 pyxdg ];
72 preConfigure = "./bootstrap";
77 makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
82 wrapGApp $out/bin/${pname}
85 # the geoclue agent may inspect these paths and expect them to be
86 # valid without having the correct $PATH set
87 postInstall = if (pname == "gammastep") then ''
88 substituteInPlace $out/share/applications/gammastep.desktop \
89 --replace 'Exec=gammastep' "Exec=$out/bin/gammastep"
90 substituteInPlace $out/share/applications/gammastep-indicator.desktop \
91 --replace 'Exec=gammastep-indicator' "Exec=$out/bin/gammastep-indicator"
93 substituteInPlace $out/share/applications/redshift.desktop \
94 --replace 'Exec=redshift' "Exec=$out/bin/redshift"
95 substituteInPlace $out/share/applications/redshift-gtk.desktop \
96 --replace 'Exec=redshift-gtk' "Exec=$out/bin/redshift-gtk"
99 enableParallelBuilding = true;
103 redshift = mkRedshift rec {
107 src = fetchFromGitHub {
111 sha256 = "12cb4gaqkybp4bkkns8pam378izr2mwhr2iy04wkprs2v92j7bz6";
115 description = "Screen color temperature manager";
117 Redshift adjusts the color temperature according to the position
118 of the sun. A different color temperature is set during night and
119 daytime. During twilight and early morning, the color temperature
120 transitions smoothly from night to daytime temperature to allow
121 your eyes to slowly adapt. At night the color temperature should
122 be set to match the lamps in your room.
124 license = licenses.gpl3Plus;
125 homepage = "http://jonls.dk/redshift";
126 platforms = platforms.unix;
127 mainProgram = "redshift";
132 gammastep = mkRedshift rec {
136 src = fetchFromGitLab {
140 hash = "sha256-EdVLBBIEjMu+yy9rmcxQf4zdW47spUz5SbBDbhmLjOU=";
143 meta = redshift.meta // {
144 name = "${pname}-${version}";
145 longDescription = "Gammastep"
146 + lib.removePrefix "Redshift" redshift.meta.longDescription;
147 homepage = "https://gitlab.com/chinstrap/gammastep";
148 mainProgram = "gammastep";
149 maintainers = (with lib.maintainers; [ primeos ]) ++ redshift.meta.maintainers;