2015-09-29 03:18:16 +02:00
|
|
|
{ fetchurl, stdenv, gettext, intltool, makeWrapper, pkgconfig
|
2015-12-10 02:37:41 +01:00
|
|
|
, geoclue2
|
2016-10-01 23:00:18 +02:00
|
|
|
, guiSupport ? true, hicolor_icon_theme, librsvg, gtk3, python, pygobject3, pyxdg
|
2015-09-29 03:18:16 +02:00
|
|
|
, drmSupport ? true, libdrm
|
|
|
|
, randrSupport ? true, libxcb
|
|
|
|
, vidModeSupport ? true, libX11, libXxf86vm
|
2015-07-26 23:22:12 +02:00
|
|
|
}:
|
2011-01-25 00:52:22 +01:00
|
|
|
|
2015-07-26 23:22:12 +02:00
|
|
|
let
|
2016-01-03 01:05:05 +01:00
|
|
|
mkFlag = flag: name: if flag
|
|
|
|
then "--enable-${name}"
|
|
|
|
else "--disable-${name}";
|
2015-07-26 23:22:12 +02:00
|
|
|
in
|
2016-01-25 20:08:34 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2013-10-26 19:15:57 +02:00
|
|
|
name = "redshift-${version}";
|
2016-01-25 20:08:34 +01:00
|
|
|
version = "1.11";
|
|
|
|
|
2011-01-25 00:52:22 +01:00
|
|
|
src = fetchurl {
|
2016-01-03 01:05:05 +01:00
|
|
|
sha256 = "0ngkwj7rg8nfk806w0sg443w6wjr91xdc0zisqfm5h2i77wm1qqh";
|
2015-07-02 19:04:18 +02:00
|
|
|
url = "https://github.com/jonls/redshift/releases/download/v${version}/redshift-${version}.tar.xz";
|
2011-01-25 00:52:22 +01:00
|
|
|
};
|
|
|
|
|
2015-12-10 02:37:41 +01:00
|
|
|
buildInputs = [ geoclue2 ]
|
2016-10-01 23:00:18 +02:00
|
|
|
++ stdenv.lib.optionals guiSupport [ hicolor_icon_theme librsvg gtk3
|
|
|
|
python pygobject3 pyxdg ]
|
2015-09-28 21:23:24 +02:00
|
|
|
++ stdenv.lib.optionals drmSupport [ libdrm ]
|
|
|
|
++ stdenv.lib.optionals randrSupport [ libxcb ]
|
|
|
|
++ stdenv.lib.optionals vidModeSupport [ libX11 libXxf86vm ];
|
2015-07-26 23:22:12 +02:00
|
|
|
nativeBuildInputs = [ gettext intltool makeWrapper pkgconfig ];
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
(mkFlag guiSupport "gui")
|
|
|
|
(mkFlag drmSupport "drm")
|
|
|
|
(mkFlag randrSupport "randr")
|
|
|
|
(mkFlag vidModeSupport "vidmode")
|
2013-10-26 19:15:57 +02:00
|
|
|
];
|
|
|
|
|
2016-01-03 01:05:05 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2015-07-26 23:22:12 +02:00
|
|
|
preInstall = stdenv.lib.optionalString guiSupport ''
|
2015-09-29 03:18:16 +02:00
|
|
|
substituteInPlace src/redshift-gtk/redshift-gtk \
|
2015-07-02 19:04:18 +02:00
|
|
|
--replace "/usr/bin/env python3" "${python}/bin/${python.executable}"
|
2013-10-26 19:15:57 +02:00
|
|
|
'';
|
2015-07-26 23:22:12 +02:00
|
|
|
postInstall = stdenv.lib.optionalString guiSupport ''
|
2015-09-29 02:01:33 +02:00
|
|
|
wrapProgram "$out/bin/redshift-gtk" \
|
2016-10-01 23:00:18 +02:00
|
|
|
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
|
2015-09-29 02:01:33 +02:00
|
|
|
--prefix PYTHONPATH : "$PYTHONPATH" \
|
2015-09-29 22:54:05 +02:00
|
|
|
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
|
2015-09-30 10:03:59 +02:00
|
|
|
--prefix XDG_DATA_DIRS : "$out/share:${hicolor_icon_theme}/share"
|
2016-01-03 01:05:05 +01:00
|
|
|
|
|
|
|
install -Dm644 {.,$out/share/doc/redshift}/redshift.conf.sample
|
2013-10-26 19:15:57 +02:00
|
|
|
'';
|
2015-07-26 23:22:12 +02:00
|
|
|
|
2013-11-03 01:03:45 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-07-02 19:04:18 +02:00
|
|
|
description = "Gradually change screen color temperature";
|
2011-01-25 00:52:22 +01:00
|
|
|
longDescription = ''
|
|
|
|
The color temperature is set according to the position of the
|
|
|
|
sun. A different color temperature is set during night and
|
|
|
|
daytime. During twilight and early morning, the color
|
|
|
|
temperature transitions smoothly from night to daytime
|
|
|
|
temperature to allow your eyes to slowly adapt.
|
2015-07-02 19:04:18 +02:00
|
|
|
'';
|
|
|
|
license = licenses.gpl3Plus;
|
2014-09-13 13:51:39 +02:00
|
|
|
homepage = http://jonls.dk/redshift;
|
2013-11-03 01:03:45 +01:00
|
|
|
platforms = platforms.linux;
|
2015-07-02 19:04:18 +02:00
|
|
|
maintainers = with maintainers; [ mornfall nckx ];
|
2011-01-25 00:52:22 +01:00
|
|
|
};
|
2013-06-07 02:13:54 +02:00
|
|
|
}
|