2013-09-26 11:12:01 +00:00
|
|
|
{ fetchgit
|
|
|
|
, stdenv
|
|
|
|
, enableXRandr ? true, xrandr ? null
|
2016-06-22 01:18:43 +00:00
|
|
|
, enableDisper ? true, disper ? null
|
2016-07-09 20:40:34 +00:00
|
|
|
, python
|
2013-09-26 11:12:01 +00:00
|
|
|
, xdpyinfo }:
|
|
|
|
|
|
|
|
assert enableXRandr -> xrandr != null;
|
|
|
|
assert enableDisper -> disper != null;
|
2013-09-24 22:10:59 +00:00
|
|
|
|
|
|
|
let
|
2016-06-22 01:18:43 +00: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 22:10:59 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
2016-06-22 01:18:43 +00:00
|
|
|
name = "autorandr-${date}";
|
2013-09-24 22:10:59 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
inherit rev;
|
2016-06-22 01:18:43 +00:00
|
|
|
url = "https://github.com/phillipberndt/autorandr.git";
|
|
|
|
sha256 = "0mnggsp42477kbzwwn65gi8y0rydk10my9iahikvs6n43lphfa1f";
|
2013-09-24 22:10:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
substituteInPlace "autorandr" \
|
2013-09-26 11:12:01 +00: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 20:40:34 +00:00
|
|
|
--replace "/usr/bin/xdpyinfo" "${xdpyinfo}/bin/xdpyinfo" \
|
|
|
|
--replace "which xxd" "false" \
|
|
|
|
--replace "python" "${python}/bin/python"
|
2013-09-24 22:10:59 +00: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 14:22:46 +00:00
|
|
|
description = "Automatic display configuration selector based on connected devices";
|
2013-09-24 22:10:59 +00:00
|
|
|
homepage = https://github.com/wertarbyte/autorandr;
|
2014-04-23 12:26:16 +00:00
|
|
|
maintainers = [ stdenv.lib.maintainers.coroa ];
|
2013-09-24 22:10:59 +00:00
|
|
|
};
|
|
|
|
}
|