diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix index 244464130be..dc799bd6ff5 100644 --- a/pkgs/applications/misc/redshift/default.nix +++ b/pkgs/applications/misc/redshift/default.nix @@ -1,7 +1,16 @@ -{ fetchurl, stdenv, gettext, geoclue, intltool, makeWrapper -, pkgconfig , python, pygobject3, pyxdg }: +{ fetchurl, stdenv, gettext, intltool, pkgconfig, makeWrapper +, 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 { name = "redshift-${version}"; src = fetchurl { @@ -9,19 +18,29 @@ stdenv.mkDerivation { url = "https://github.com/jonls/redshift/releases/download/v${version}/redshift-${version}.tar.xz"; }; - buildInputs = [ - gettext intltool makeWrapper pkgconfig python pygobject3 pyxdg + buildInputs = [ geoclue ] + ++ 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 \ --replace "/usr/bin/env python3" "${python}/bin/${python.executable}" ''; -/* - postInstall = '' - wrapProgram "$out/bin/redshift-gtk" --prefix PYTHONPATH : $PYTHONPATH + + postInstall = stdenv.lib.optionalString guiSupport '' + wrapProgram "$out/bin/redshift-gtk" --prefix PYTHONPATH : "$PYTHONPATH" ''; -*/ + meta = with stdenv.lib; { inherit version; description = "Gradually change screen color temperature";