diff options
Diffstat (limited to 'pkgs/tools/misc/autorandr/default.nix')
-rw-r--r-- | pkgs/tools/misc/autorandr/default.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/pkgs/tools/misc/autorandr/default.nix b/pkgs/tools/misc/autorandr/default.nix new file mode 100644 index 000000000000..2c7505260a69 --- /dev/null +++ b/pkgs/tools/misc/autorandr/default.nix @@ -0,0 +1,40 @@ +{ fetchgit +, stdenv +, enableXRandr ? true, xrandr ? null +, enableDisper ? false, disper ? null +, xdpyinfo }: + +assert enableXRandr -> xrandr != null; +assert enableDisper -> disper != null; + +let + rev = "4f5e2401ef"; +in + stdenv.mkDerivation { + name = "autorandr-${rev}"; + + src = fetchgit { + inherit rev; + url = "https://github.com/wertarbyte/autorandr.git"; + }; + + patchPhase = '' + substituteInPlace "autorandr" \ + --replace "/usr/bin/xrandr" "${if enableXRandr then xrandr else "/nowhere"}/bin/xrandr" \ + --replace "/usr/bin/disper" "${if enableDisper then disper else "/nowhere"}/bin/disper" \ + --replace "/usr/bin/xdpyinfo" "${xdpyinfo}/bin/xdpyinfo" + ''; + + 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 = { + description = "Automatic display configuration selector based on connected devices"; + homepage = https://github.com/wertarbyte/autorandr; + maintainer = [ stdenv.lib.maintainers.coroa ]; + }; + } |