2013-09-26 12:12:01 +01:00
|
|
|
{ fetchgit
|
|
|
|
, stdenv
|
|
|
|
, enableXRandr ? true, xrandr ? null
|
2016-06-22 02:18:43 +01:00
|
|
|
, enableDisper ? true, disper ? null
|
2016-07-09 21:40:34 +01:00
|
|
|
, python
|
2013-09-26 12:12:01 +01:00
|
|
|
, xdpyinfo }:
|
|
|
|
|
|
|
|
assert enableXRandr -> xrandr != null;
|
|
|
|
assert enableDisper -> disper != null;
|
2013-09-24 23:10:59 +01:00
|
|
|
|
|
|
|
let
|
2016-06-22 02:18:43 +01:00
|
|
|
# Revision and date taken from the legacy tree, which still
|
|
|
|
# supports disper:
|
|
|
|
# https://github.com/phillipberndt/autorandr/tree/legacy
|
|
|
|
rev = "59f6aec0bb72e26751ce285d079e085b7178e45d";
|
|
|
|
date = "20150127";
|
2013-09-24 23:10:59 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2016-06-22 02:18:43 +01:00
|
|
|
name = "autorandr-${date}";
|
2013-09-24 23:10:59 +01:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
inherit rev;
|
2016-06-22 02:18:43 +01:00
|
|
|
url = "https://github.com/phillipberndt/autorandr.git";
|
|
|
|
sha256 = "0mnggsp42477kbzwwn65gi8y0rydk10my9iahikvs6n43lphfa1f";
|
2013-09-24 23:10:59 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace "autorandr" \
|
2013-09-26 12:12:01 +01:00
|
|
|
--replace "/usr/bin/xrandr" "${if enableXRandr then xrandr else "/nowhere"}/bin/xrandr" \
|
|
|
|
--replace "/usr/bin/disper" "${if enableDisper then disper else "/nowhere"}/bin/disper" \
|
2016-07-09 21:40:34 +01:00
|
|
|
--replace "/usr/bin/xdpyinfo" "${xdpyinfo}/bin/xdpyinfo" \
|
|
|
|
--replace "which xxd" "false" \
|
|
|
|
--replace "python" "${python}/bin/python"
|
2013-09-24 23:10:59 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/etc/bash_completion.d"
|
|
|
|
cp -v bash_completion/autorandr "$out/etc/bash_completion.d"
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
cp -v autorandr auto-disper $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2013-10-05 15:22:46 +01:00
|
|
|
description = "Automatic display configuration selector based on connected devices";
|
2013-09-24 23:10:59 +01:00
|
|
|
homepage = https://github.com/wertarbyte/autorandr;
|
2014-04-23 13:26:16 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.coroa ];
|
2013-09-24 23:10:59 +01:00
|
|
|
};
|
|
|
|
}
|