nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 184 lines 5.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchFromGitLab, 6 autoconf, 7 automake, 8 gettext, 9 intltool, 10 libtool, 11 pkg-config, 12 wrapGAppsHook3, 13 wrapPython, 14 gobject-introspection, 15 wayland-scanner, 16 gtk3, 17 python, 18 pygobject3, 19 pyxdg, 20 21 withQuartz ? stdenv.hostPlatform.isDarwin, 22 withRandr ? stdenv.hostPlatform.isLinux, 23 libxcb, 24 withDrm ? stdenv.hostPlatform.isLinux, 25 libdrm, 26 withVidmode ? stdenv.hostPlatform.isLinux, 27 libXxf86vm, 28 29 withGeolocation ? true, 30 withCoreLocation ? withGeolocation && stdenv.hostPlatform.isDarwin, 31 withGeoclue ? withGeolocation && stdenv.hostPlatform.isLinux, 32 geoclue, 33 withAppIndicator ? stdenv.hostPlatform.isLinux, 34 libappindicator, 35 libayatana-appindicator, 36}: 37 38let 39 mkRedshift = 40 { 41 pname, 42 version, 43 src, 44 meta, 45 }: 46 stdenv.mkDerivation rec { 47 inherit 48 pname 49 version 50 src 51 meta 52 ; 53 54 strictDeps = true; 55 56 depsBuildBuild = [ pkg-config ]; 57 58 nativeBuildInputs = [ 59 autoconf 60 automake 61 gettext 62 intltool 63 libtool 64 pkg-config 65 wrapGAppsHook3 66 wrapPython 67 gobject-introspection 68 python 69 ] 70 ++ lib.optionals (pname == "gammastep") [ wayland-scanner ]; 71 72 configureFlags = [ 73 "--enable-randr=${if withRandr then "yes" else "no"}" 74 "--enable-geoclue2=${if withGeoclue then "yes" else "no"}" 75 "--enable-drm=${if withDrm then "yes" else "no"}" 76 "--enable-vidmode=${if withVidmode then "yes" else "no"}" 77 "--enable-quartz=${if withQuartz then "yes" else "no"}" 78 "--enable-corelocation=${if withCoreLocation then "yes" else "no"}" 79 ] 80 ++ lib.optionals (pname == "gammastep") [ 81 "--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user/" 82 "--enable-apparmor" 83 ]; 84 85 buildInputs = [ 86 gtk3 87 ] 88 ++ lib.optional withRandr libxcb 89 ++ lib.optional withGeoclue geoclue 90 ++ lib.optional withDrm libdrm 91 ++ lib.optional withVidmode libXxf86vm 92 ++ lib.optional withAppIndicator ( 93 if (pname != "gammastep") then libappindicator else libayatana-appindicator 94 ); 95 96 pythonPath = [ 97 pygobject3 98 pyxdg 99 ]; 100 101 preConfigure = "./bootstrap"; 102 103 dontWrapGApps = true; 104 105 preFixup = '' 106 makeWrapperArgs+=("''${gappsWrapperArgs[@]}") 107 ''; 108 109 postFixup = '' 110 wrapPythonPrograms 111 wrapGApp $out/bin/${pname} 112 ''; 113 114 # the geoclue agent may inspect these paths and expect them to be 115 # valid without having the correct $PATH set 116 postInstall = 117 if (pname == "gammastep") then 118 '' 119 substituteInPlace $out/share/applications/gammastep.desktop \ 120 --replace 'Exec=gammastep' "Exec=$out/bin/gammastep" 121 substituteInPlace $out/share/applications/gammastep-indicator.desktop \ 122 --replace 'Exec=gammastep-indicator' "Exec=$out/bin/gammastep-indicator" 123 '' 124 else 125 '' 126 substituteInPlace $out/share/applications/redshift.desktop \ 127 --replace 'Exec=redshift' "Exec=$out/bin/redshift" 128 substituteInPlace $out/share/applications/redshift-gtk.desktop \ 129 --replace 'Exec=redshift-gtk' "Exec=$out/bin/redshift-gtk" 130 ''; 131 132 enableParallelBuilding = true; 133 }; 134in 135rec { 136 redshift = mkRedshift rec { 137 pname = "redshift"; 138 version = "1.12"; 139 140 src = fetchFromGitHub { 141 owner = "jonls"; 142 repo = "redshift"; 143 rev = "v${version}"; 144 sha256 = "12cb4gaqkybp4bkkns8pam378izr2mwhr2iy04wkprs2v92j7bz6"; 145 }; 146 147 meta = with lib; { 148 description = "Screen color temperature manager"; 149 longDescription = '' 150 Redshift adjusts the color temperature according to the position 151 of the sun. A different color temperature is set during night and 152 daytime. During twilight and early morning, the color temperature 153 transitions smoothly from night to daytime temperature to allow 154 your eyes to slowly adapt. At night the color temperature should 155 be set to match the lamps in your room. 156 ''; 157 license = licenses.gpl3Plus; 158 homepage = "http://jonls.dk/redshift"; 159 platforms = platforms.unix; 160 mainProgram = "redshift"; 161 maintainers = [ ]; 162 }; 163 }; 164 165 gammastep = mkRedshift rec { 166 pname = "gammastep"; 167 version = "2.0.11"; 168 169 src = fetchFromGitLab { 170 owner = "chinstrap"; 171 repo = pname; 172 rev = "v${version}"; 173 hash = "sha256-c8JpQLHHLYuzSC9bdymzRTF6dNqOLwYqgwUOpKcgAEU="; 174 }; 175 176 meta = redshift.meta // { 177 name = "${pname}-${version}"; 178 longDescription = "Gammastep" + lib.removePrefix "Redshift" redshift.meta.longDescription; 179 homepage = "https://gitlab.com/chinstrap/gammastep"; 180 mainProgram = "gammastep"; 181 maintainers = (with lib.maintainers; [ ]) ++ redshift.meta.maintainers; 182 }; 183 }; 184}