redshift: fix dependencies, make configurable

This commit is contained in:
Tobias Geerinckx-Rice 2015-07-26 23:22:12 +02:00
parent abc7c1b013
commit 10f419dae4

View File

@ -1,7 +1,16 @@
{ fetchurl, stdenv, gettext, geoclue, intltool, makeWrapper { fetchurl, stdenv, gettext, intltool, pkgconfig, makeWrapper
, pkgconfig , python, pygobject3, pyxdg }: , geoclue, python, pygobject3, pyxdg
, libdrm, libX11, libxcb, libXxf86vm
, guiSupport ? true
, drmSupport ? true
, randrSupport ? true
, vidModeSupport ? true
}:
let version = "1.10"; in let
version = "1.10";
mkFlag = flag: name: if flag then "--enable-${name}" else "--disable-${name}";
in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "redshift-${version}"; name = "redshift-${version}";
src = fetchurl { src = fetchurl {
@ -9,19 +18,29 @@ stdenv.mkDerivation {
url = "https://github.com/jonls/redshift/releases/download/v${version}/redshift-${version}.tar.xz"; url = "https://github.com/jonls/redshift/releases/download/v${version}/redshift-${version}.tar.xz";
}; };
buildInputs = [ buildInputs = [ geoclue ]
gettext intltool makeWrapper pkgconfig python pygobject3 pyxdg ++ stdenv.lib.optional guiSupport [ python pygobject3 pyxdg ]
++ stdenv.lib.optional drmSupport [ libdrm ]
++ stdenv.lib.optional randrSupport [ libxcb ]
++ stdenv.lib.optional vidModeSupport [ libX11 libXxf86vm ];
nativeBuildInputs = [ gettext intltool makeWrapper pkgconfig ];
configureFlags = [
(mkFlag guiSupport "gui")
(mkFlag drmSupport "drm")
(mkFlag randrSupport "randr")
(mkFlag vidModeSupport "vidmode")
]; ];
preInstall = '' preInstall = stdenv.lib.optionalString guiSupport ''
substituteInPlace src/redshift-gtk/redshift-gtk python \ substituteInPlace src/redshift-gtk/redshift-gtk python \
--replace "/usr/bin/env python3" "${python}/bin/${python.executable}" --replace "/usr/bin/env python3" "${python}/bin/${python.executable}"
''; '';
/*
postInstall = '' postInstall = stdenv.lib.optionalString guiSupport ''
wrapProgram "$out/bin/redshift-gtk" --prefix PYTHONPATH : $PYTHONPATH wrapProgram "$out/bin/redshift-gtk" --prefix PYTHONPATH : "$PYTHONPATH"
''; '';
*/
meta = with stdenv.lib; { meta = with stdenv.lib; {
inherit version; inherit version;
description = "Gradually change screen color temperature"; description = "Gradually change screen color temperature";