at 22.05-pre 152 lines 5.1 kB view raw
1{ lib, stdenv, fetchFromGitHub, fetchFromGitLab 2, autoconf, automake, gettext, intltool 3, libtool, pkg-config, wrapGAppsHook, wrapPython, gobject-introspection 4, gtk3, python, pygobject3, pyxdg 5 6, withQuartz ? stdenv.isDarwin, ApplicationServices 7, withRandr ? stdenv.isLinux, libxcb 8, withDrm ? stdenv.isLinux, libdrm 9 10, withGeolocation ? true 11, withCoreLocation ? withGeolocation && stdenv.isDarwin, CoreLocation, Foundation, Cocoa 12, withGeoclue ? withGeolocation && stdenv.isLinux, geoclue 13, withAppIndicator ? stdenv.isLinux, libappindicator, libayatana-appindicator 14}: 15 16let 17 mkRedshift = 18 { pname, version, src, meta }: 19 stdenv.mkDerivation rec { 20 inherit pname version src meta; 21 22 patches = lib.optionals (pname != "gammastep") [ 23 # https://github.com/jonls/redshift/pull/575 24 ./575.patch 25 ]; 26 27 nativeBuildInputs = [ 28 autoconf 29 automake 30 gettext 31 intltool 32 libtool 33 pkg-config 34 wrapGAppsHook 35 wrapPython 36 ]; 37 38 configureFlags = [ 39 "--enable-randr=${if withRandr then "yes" else "no"}" 40 "--enable-geoclue2=${if withGeoclue then "yes" else "no"}" 41 "--enable-drm=${if withDrm then "yes" else "no"}" 42 "--enable-quartz=${if withQuartz then "yes" else "no"}" 43 "--enable-corelocation=${if withCoreLocation then "yes" else "no"}" 44 ] ++ lib.optionals (pname == "gammastep") [ 45 "--with-systemduserunitdir=${placeholder "out"}/share/systemd/user/" 46 "--enable-apparmor" 47 ]; 48 49 buildInputs = [ 50 gobject-introspection 51 gtk3 52 python 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") 59 then libappindicator 60 else libayatana-appindicator) 61 ; 62 63 pythonPath = [ pygobject3 pyxdg ]; 64 65 preConfigure = "./bootstrap"; 66 67 postFixup = "wrapPythonPrograms"; 68 69 # the geoclue agent may inspect these paths and expect them to be 70 # valid without having the correct $PATH set 71 postInstall = if (pname == "gammastep") then '' 72 substituteInPlace $out/share/applications/gammastep.desktop \ 73 --replace 'Exec=gammastep' "Exec=$out/bin/gammastep" 74 substituteInPlace $out/share/applications/gammastep-indicator.desktop \ 75 --replace 'Exec=gammastep-indicator' "Exec=$out/bin/gammastep-indicator" 76 '' else '' 77 substituteInPlace $out/share/applications/redshift.desktop \ 78 --replace 'Exec=redshift' "Exec=$out/bin/redshift" 79 substituteInPlace $out/share/applications/redshift-gtk.desktop \ 80 --replace 'Exec=redshift-gtk' "Exec=$out/bin/redshift-gtk" 81 ''; 82 83 enableParallelBuilding = true; 84 }; 85in 86rec { 87 redshift = mkRedshift rec { 88 pname = "redshift"; 89 version = "1.12"; 90 91 src = fetchFromGitHub { 92 owner = "jonls"; 93 repo = "redshift"; 94 rev = "v${version}"; 95 sha256 = "12cb4gaqkybp4bkkns8pam378izr2mwhr2iy04wkprs2v92j7bz6"; 96 }; 97 98 meta = with lib; { 99 description = "Screen color temperature manager"; 100 longDescription = '' 101 Redshift adjusts the color temperature according to the position 102 of the sun. A different color temperature is set during night and 103 daytime. During twilight and early morning, the color temperature 104 transitions smoothly from night to daytime temperature to allow 105 your eyes to slowly adapt. At night the color temperature should 106 be set to match the lamps in your room. 107 ''; 108 license = licenses.gpl3Plus; 109 homepage = "http://jonls.dk/redshift"; 110 platforms = platforms.unix; 111 maintainers = with maintainers; [ yegortimoshenko globin ]; 112 }; 113 }; 114 115 redshift-wlr = mkRedshift { 116 pname = "redshift-wlr"; 117 # upstream rebases so this is the push date 118 version = "2019-08-24"; 119 120 src = fetchFromGitHub { 121 owner = "minus7"; 122 repo = "redshift"; 123 rev = "7da875d34854a6a34612d5ce4bd8718c32bec804"; 124 sha256 = "0rs9bxxrw4wscf4a8yl776a8g880m5gcm75q06yx2cn3lw2b7v22"; 125 }; 126 127 meta = redshift.meta // { 128 description = redshift.meta.description + "(with wlroots patches)"; 129 homepage = "https://github.com/minus7/redshift"; 130 }; 131 }; 132 133 gammastep = mkRedshift rec { 134 pname = "gammastep"; 135 version = "2.0.7"; 136 137 src = fetchFromGitLab { 138 owner = "chinstrap"; 139 repo = pname; 140 rev = "v${version}"; 141 sha256 = "sha256-78z2CQ+r7undbp+8E0mMDNWWl+RXeS5he/ax0VomRYY="; 142 }; 143 144 meta = redshift.meta // { 145 name = "${pname}-${version}"; 146 longDescription = "Gammastep" 147 + lib.removePrefix "Redshift" redshift.meta.longDescription; 148 homepage = "https://gitlab.com/chinstrap/gammastep"; 149 maintainers = [ lib.maintainers.primeos ] ++ redshift.meta.maintainers; 150 }; 151 }; 152}