11 python3.pkgs.buildPythonApplication rec {
16 src = fetchFromGitHub {
17 owner = "phillipberndt";
19 rev = "refs/tags/${version}";
20 hash = "sha256-8FMfy3GCN4z/TnfefU2DbKqV3W35I29/SuGGqeOrjNg";
27 propagatedBuildInputs = with python3.pkgs; [ packaging ];
30 substituteInPlace autorandr.py \
31 --replace 'os.popen("xrandr' 'os.popen("${xrandr}/bin/xrandr' \
32 --replace '["xrandr"]' '["${xrandr}/bin/xrandr"]'
35 patches = [ ./0001-don-t-use-sys.executable.patch ];
44 make install TARGETS='autorandr' PREFIX=$out
46 # zsh completions exist but currently have no make target, use
47 # installShellCompletions for both
48 # see https://github.com/phillipberndt/autorandr/issues/197
49 installShellCompletion --cmd autorandr \
50 --bash contrib/bash_completion/autorandr \
51 --zsh contrib/zsh_completion/_autorandr \
52 --fish contrib/fish_completion/autorandr.fish
54 make install TARGETS='autostart_config' PREFIX=$out DESTDIR=$out
56 make install TARGETS='manpage' PREFIX=$man
59 if systemd != null then
61 make install TARGETS='systemd udev' PREFIX=$out DESTDIR=$out \
62 SYSTEMD_UNIT_DIR=/lib/systemd/system \
63 UDEV_RULES_DIR=/etc/udev/rules.d
64 substituteInPlace $out/etc/udev/rules.d/40-monitor-hotplug.rules \
65 --replace /bin/systemctl "/run/current-system/systemd/bin/systemctl"
69 make install TARGETS='pmutils' DESTDIR=$out \
70 PM_SLEEPHOOKS_DIR=/lib/pm-utils/sleep.d
71 make install TARGETS='udev' PREFIX=$out DESTDIR=$out \
72 UDEV_RULES_DIR=/etc/udev/rules.d
80 homepage = "https://github.com/phillipberndt/autorandr/";
81 description = "Automatically select a display configuration based on connected devices";
82 license = licenses.gpl3Plus;
83 maintainers = with maintainers; [ coroa ];
84 platforms = platforms.unix;
85 mainProgram = "autorandr";