summary refs log tree commit diff
path: root/pkgs/applications/misc/redshift/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/misc/redshift/default.nix')
-rw-r--r--pkgs/applications/misc/redshift/default.nix89
1 files changed, 42 insertions, 47 deletions
diff --git a/pkgs/applications/misc/redshift/default.nix b/pkgs/applications/misc/redshift/default.nix
index 3fe0503d7f9d..b4f37719046d 100644
--- a/pkgs/applications/misc/redshift/default.nix
+++ b/pkgs/applications/misc/redshift/default.nix
@@ -1,68 +1,63 @@
-{ fetchurl, stdenv, gettext, intltool, makeWrapper, pkgconfig
-, geoclue2
-, guiSupport ? true, hicolor_icon_theme, librsvg, gtk3, python, pygobject3, pyxdg
-, drmSupport ? true, libdrm
-, randrSupport ? true, libxcb
-, vidModeSupport ? true, libX11, libXxf86vm
-}:
+{ stdenv, fetchFromGitHub, fetchurl, autoconf, automake, gettext, intltool
+, libtool, pkgconfig, wrapGAppsHook, wrapPython, geoclue2, gobjectIntrospection
+, gtk3, python, pygobject3, pyxdg, libdrm, libxcb }:
 
-let
-  mkFlag = flag: name: if flag
-    then "--enable-${name}"
-    else "--disable-${name}";
-in
 stdenv.mkDerivation rec {
   name = "redshift-${version}";
   version = "1.11";
 
-  src = fetchurl {
-    sha256 = "0ngkwj7rg8nfk806w0sg443w6wjr91xdc0zisqfm5h2i77wm1qqh";
-    url = "https://github.com/jonls/redshift/releases/download/v${version}/redshift-${version}.tar.xz";
+  src = fetchFromGitHub {
+    owner = "jonls";
+    repo = "redshift";
+    rev = "v${version}";
+    sha256 = "0jfi4wqklqw2rm0r2xwalyzir88zkdvqj0z5id0l5v20vsrfiiyj";
   };
 
-  buildInputs = [ geoclue2 ]
-    ++ stdenv.lib.optionals guiSupport [ hicolor_icon_theme librsvg gtk3
-      python pygobject3 pyxdg ]
-    ++ stdenv.lib.optionals drmSupport [ libdrm ]
-    ++ stdenv.lib.optionals randrSupport [ libxcb ]
-    ++ stdenv.lib.optionals vidModeSupport [ libX11 libXxf86vm ];
-  nativeBuildInputs = [ gettext intltool makeWrapper pkgconfig ];
+  patches = [
+    # https://github.com/jonls/redshift/pull/575
+    ./575.patch
+  ];
 
-  configureFlags = [
-    (mkFlag guiSupport "gui")
-    (mkFlag drmSupport "drm")
-    (mkFlag randrSupport "randr")
-    (mkFlag vidModeSupport "vidmode")
+  nativeBuildInputs = [
+    autoconf
+    automake
+    gettext
+    intltool
+    libtool
+    pkgconfig
+    wrapGAppsHook
+    wrapPython
   ];
 
-  enableParallelBuilding = true;
+  buildInputs = [
+    geoclue2
+    gobjectIntrospection
+    gtk3
+    libdrm
+    libxcb
+    python
+  ];
 
-  preInstall = stdenv.lib.optionalString guiSupport ''
-    substituteInPlace src/redshift-gtk/redshift-gtk \
-      --replace "/usr/bin/env python3" "${python}/bin/${python.executable}"
-  '';
-  postInstall = stdenv.lib.optionalString guiSupport ''
-    wrapProgram "$out/bin/redshift-gtk" \
-      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
-      --prefix PYTHONPATH : "$PYTHONPATH" \
-      --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
-      --prefix XDG_DATA_DIRS : "$out/share:${hicolor_icon_theme}/share"
+  pythonPath = [ pygobject3 pyxdg ];
 
-    install -Dm644 {.,$out/share/doc/redshift}/redshift.conf.sample
-  '';
+  preConfigure = "./bootstrap";
+  postFixup = "wrapPythonPrograms";
+
+  enableParallelBuilding = true;
 
   meta = with stdenv.lib; {
-    description = "Gradually change screen color temperature";
+    description = "Screen color temperature manager";
     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.
+      Redshift adjusts the color temperature 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. At night the color temperature should
+      be set to match the lamps in your room.
     '';
     license = licenses.gpl3Plus;
     homepage = http://jonls.dk/redshift;
     platforms = platforms.linux;
     maintainers = with maintainers; [ mornfall nckx ];
-  }; 
+  };
 }