This is.. filled with hacks. But it works, and is in the `blueplum.nix` file, which is specialized for my machine anyways.
92 lines
2.2 KiB
Nix
92 lines
2.2 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib ? pkgs.lib,
|
|
...
|
|
}:
|
|
|
|
let
|
|
concat = strings: builtins.concatStringsSep " " strings;
|
|
wacom.src =
|
|
let
|
|
xsetwacom = "${pkgs.xf86_input_wacom}/bin/xsetwacom";
|
|
awk = lib.getExe pkgs.gawk;
|
|
in
|
|
''
|
|
#!/bin/sh
|
|
|
|
# Wait for X socket
|
|
for i in $(seq 30); do
|
|
[ -S /tmp/.X11-unix/X0 ] && break
|
|
sleep 0.5
|
|
done
|
|
|
|
# Just to be sure that the displays are ready...
|
|
sleep 5
|
|
|
|
export DISPLAY=:0
|
|
export XAUTHORITY="$HOME/.Xauthority"
|
|
|
|
for i in $(seq 10); do
|
|
if ${xsetwacom} list devices | grep -q Wacom; then
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
stylus=$(${xsetwacom} list devices | ${awk} -F' \t' '/stylus/{print $1}')
|
|
|
|
if [ -z "$${stylus}" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
${xsetwacom} set "$stylus" MapToOutput HEAD-0
|
|
'';
|
|
in
|
|
{
|
|
services.xserver.videoDrivers = [ "nvidia" ];
|
|
services.xserver.wacom.enable = true;
|
|
|
|
hardware.nvidia = {
|
|
modesetting.enable = true;
|
|
|
|
open = true;
|
|
|
|
nvidiaSettings = true;
|
|
|
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
};
|
|
|
|
home-manager.users.anton.xsession.profileExtra = concat [
|
|
"${lib.getExe pkgs.xorg.xrandr}"
|
|
"${concat [
|
|
"--output DP-2"
|
|
"--mode 1920x1080"
|
|
"--pos 0x0"
|
|
"--rate 144"
|
|
"--primary"
|
|
]}"
|
|
"${concat [
|
|
"--output HDMI-0"
|
|
"--mode 1920x1080"
|
|
"--pos 1920x0"
|
|
"--rate 144"
|
|
]}"
|
|
];
|
|
|
|
systemd.user.services.wacom = {
|
|
enable = true;
|
|
description = "Configure my Wacom (One) tablet";
|
|
wantedBy = [ "default.target" ];
|
|
after = [ "graphical-session.target" ];
|
|
serviceConfig = {
|
|
Type = "oneshot";
|
|
ExecStart = pkgs.writeShellScript "wacom.sh" wacom.src;
|
|
};
|
|
};
|
|
|
|
services.udev.extraRules = ''
|
|
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="056a", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}+="wacom.service"
|
|
'';
|
|
}
|