1 { lib, stdenv, fetchFromGitHub, fetchFromGitLab
2 , autoconf, automake, gettext, intltool
3 , libtool, pkg-config, wrapGAppsHook, wrapPython, gobject-introspection
4 , gtk3, python, pygobject3, pyxdg
6 , withQuartz ? stdenv.isDarwin, ApplicationServices
7 , withRandr ? stdenv.isLinux, libxcb
8 , withDrm ? stdenv.isLinux, libdrm
10 , withGeolocation ? true
11 , withCoreLocation ? withGeolocation && stdenv.isDarwin, CoreLocation, Foundation, Cocoa
12 , withGeoclue ? withGeolocation && stdenv.isLinux, geoclue
13 , withAppIndicator ? stdenv.isLinux, libappindicator, libayatana-appindicator
18 { pname, version, src, meta }:
19 stdenv.mkDerivation rec {
20 inherit pname version src meta;
22 patches = lib.optionals (pname != "gammastep") [
23 # https://github.com/jonls/redshift/pull/575
40 "--enable-randr=${if withRandr then "yes" else "no"}"
41 "--enable-geoclue2=${if withGeoclue then "yes" else "no"}"
42 "--enable-drm=${if withDrm then "yes" else "no"}"
43 "--enable-quartz=${if withQuartz then "yes" else "no"}"
44 "--enable-corelocation=${if withCoreLocation then "yes" else "no"}"
45 ] ++ lib.optionals (pname == "gammastep") [
46 "--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user/"
53 ] ++ lib.optional withRandr libxcb
54 ++ lib.optional withGeoclue geoclue
55 ++ lib.optional withDrm libdrm
56 ++ lib.optional withQuartz ApplicationServices
57 ++ lib.optionals withCoreLocation [ CoreLocation Foundation Cocoa ]
58 ++ lib.optional withAppIndicator (if (pname != "gammastep")
60 else libayatana-appindicator)
63 pythonPath = [ pygobject3 pyxdg ];
65 preConfigure = "./bootstrap";
70 makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
75 wrapGApp $out/bin/${pname}
78 # the geoclue agent may inspect these paths and expect them to be
79 # valid without having the correct $PATH set
80 postInstall = if (pname == "gammastep") then ''
81 substituteInPlace $out/share/applications/gammastep.desktop \
82 --replace 'Exec=gammastep' "Exec=$out/bin/gammastep"
83 substituteInPlace $out/share/applications/gammastep-indicator.desktop \
84 --replace 'Exec=gammastep-indicator' "Exec=$out/bin/gammastep-indicator"
86 substituteInPlace $out/share/applications/redshift.desktop \
87 --replace 'Exec=redshift' "Exec=$out/bin/redshift"
88 substituteInPlace $out/share/applications/redshift-gtk.desktop \
89 --replace 'Exec=redshift-gtk' "Exec=$out/bin/redshift-gtk"
92 enableParallelBuilding = true;
96 redshift = mkRedshift rec {
100 src = fetchFromGitHub {
104 sha256 = "12cb4gaqkybp4bkkns8pam378izr2mwhr2iy04wkprs2v92j7bz6";
108 description = "Screen color temperature manager";
110 Redshift adjusts the color temperature according to the position
111 of the sun. A different color temperature is set during night and
112 daytime. During twilight and early morning, the color temperature
113 transitions smoothly from night to daytime temperature to allow
114 your eyes to slowly adapt. At night the color temperature should
115 be set to match the lamps in your room.
117 license = licenses.gpl3Plus;
118 homepage = "http://jonls.dk/redshift";
119 platforms = platforms.unix;
120 mainProgram = "redshift";
121 maintainers = with maintainers; [ yana ];
125 gammastep = mkRedshift rec {
129 src = fetchFromGitLab {
133 sha256 = "sha256-EdVLBBIEjMu+yy9rmcxQf4zdW47spUz5SbBDbhmLjOU=";
136 meta = redshift.meta // {
137 name = "${pname}-${version}";
138 longDescription = "Gammastep"
139 + lib.removePrefix "Redshift" redshift.meta.longDescription;
140 homepage = "https://gitlab.com/chinstrap/gammastep";
141 mainProgram = "gammastep";
142 maintainers = (with lib.maintainers; [ eclairevoyant primeos ]) ++ redshift.meta.maintainers;