reworked sxhkd, added QMK stuff, fixed VM

This commit is contained in:
Gerg-L 2023-11-05 00:58:49 -04:00
parent 928040c5cf
commit 56c9d32f85
Signed by: gerg-l
SSH key fingerprint: SHA256:FPYDHIkvMocr4wdmZXpgpJjsb2Tw6rASs2ISPbOb0KI
5 changed files with 95 additions and 91 deletions

View file

@ -177,10 +177,19 @@
<source dev='/dev/input/by-id/usb-Logitech_G502_HERO_Gaming_Mouse_1974396F3638-event-mouse'/>
</input>
<input type='evdev'>
<source dev='/dev/input/by-id/usb-Logitech_Gaming_Keyboard_G610_067A397A3637-event-kbd' grab='all' repeat='on'/>
<source dev='/dev/input/by-id/usb-Logitech_G502_HERO_Gaming_Mouse_1974396F3638-if01-event-kbd'/>
</input>
<input type='evdev'>
<source dev='/dev/input/by-id/usb-Logitech_G502_HERO_Gaming_Mouse_1974396F3638-if01-event-kbd'/>
<source dev='/dev/input/by-id/usb-Keychron_Keychron_V6-event-kbd' grab='all' repeat='on'/>
</input>
<input type='evdev'>
<source dev='/dev/input/by-id/usb-Keychron_Keychron_V6-event-if02'/>
</input>
<input type='evdev'>
<source dev='/dev/input/by-id/usb-Keychron_Keychron_V6-if02-event-kbd'/>
</input>
<input type='evdev'>
<source dev='/dev/input/by-id/usb-Keychron_Keychron_V6-if02-event-mouse'/>
</input>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
@ -208,8 +217,6 @@
<qemu:arg value='-device'/>
<qemu:arg value='hda-duplex,audiodev=audio0'/>
<qemu:env name='PIPEWIRE_RUNTIME_DIR' value='/run/user/1000'/>
<qemu:env name='PIPEWIRE_LATENCY' value='512/48000'/>
<qemu:env name='LD_LIBRARY_PATH' value='$LD_LIBRARY_PATH:/run/current-system/sw/lib/pipewire'/>
</qemu:commandline>
</domain>

View file

@ -3,9 +3,6 @@
{
local = {
remoteBuild.isBuilder = true;
X11Programs = {
sxhkd.enable = true;
};
DE.dwm.enable = true;
DM = {
lightdm.enable = true;
@ -73,6 +70,9 @@
nix-index
element-desktop
webcord
# QMK configuration
via
qmk
;
inherit (nvim-flake.packages) neovim;
inherit fmt;
@ -103,7 +103,11 @@
};
};
services.udev.packages = [ pkgs.android-udev-rules ];
services.udev.packages = [
pkgs.android-udev-rules
pkgs.via
pkgs.qmk-udev-rules
];
programs.adb.enable = true;
networking = {

View file

@ -145,11 +145,9 @@ in
'';
systemd.tmpfiles.settings."vfio" = {
"/etc/Xorg/active.conf"."L".argument = "/etc/Xorg/2_mon.conf";
"/var/lib/libvirt/qemu/Windows.xml"."L+".argument = toString ./Windows.xml;
"/var/lib/libvirt/hooks/qemu"."L+".argument = lib.getExe (
pkgs.writeShellApplication {
systemd.tmpfiles.rules =
let
qemuHook = pkgs.writeShellApplication {
name = "qemu-hook";
runtimeInputs = [
@ -157,11 +155,12 @@ in
pkgs.systemd
pkgs.kmod
];
text = ''
GUEST_NAME="$1"
OPERATION="$2"
if [ "$GUEST_NAME" == "Windows" ]; then
if [ "$GUEST_NAME" != "Windows" ]; then
exit 0
fi
@ -190,9 +189,14 @@ in
rm /etc/Xorg/ONE_MONITOR
systemctl start display-manager.service
fi
'';
}
);
};
in
[
"L /etc/Xorg/active.conf - - - - /etc/Xorg/2_mon.conf"
"L+ /var/lib/libvirt/hooks/qemu - - - - ${lib.getExe qemuHook}"
"L+ /var/lib/libvirt/qemu/Windows.xml - - - - ${./Windows.xml}"
];
_file = ./vfio.nix;
}

View file

@ -14,9 +14,10 @@
enable = true;
displayManager = {
sessionCommands = ''
${lib.getExe pkgs.feh} --bg-center "${self.packages.images}/recursion.png"
${lib.getExe pkgs.numlockx}
${lib.getExe pkgs.picom} &
feh --bg-center "${self.packages.images}/recursion.png"
numlockx
picom &
sxhkd &
'';
defaultSession = "none+dwm";
};
@ -43,8 +44,56 @@
}
];
};
environment.systemPackages = builtins.attrValues {
environment = {
systemPackages = builtins.attrValues {
inherit (suckless.packages) dmenu dwm st;
inherit (pkgs)
maim
playerctl
xclip
alsa-utils
feh
numlockx
picom
;
sxhkd = pkgs.symlinkJoin {
name = "sxhkd";
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
paths = [ pkgs.sxhkd ];
postBuild = ''
wrapProgram $out/bin/sxhkd \
--add-flags "-c /etc/sxhkd/sxhkdrc"
'';
};
};
etc."sxhkd/sxhkdrc".text = ''
XF86AudioPlay
playerctl play-pause
XF86AudioPause
playerctl play-pause
XF86AudioStop
playerctl stop
XF86AudioNext
playerctl next
XF86AudioPrev
playerctl previous
XF86AudioRaiseVolume
amixer sset Master 1%+
XF86AudioLowerVolume
amixer sset Master 1%-
XF86AudioMute
amixer sset Master toggle
Print
maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg
Print + shift
maim | xclip -selection clipboard -t image/png
super + Print
maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg
super + Print + shift
maim -s | xclip -selection clipboard -t image/png
super + ctrl + r
pkill -usr1 -x sxhkd
'';
};
};
_file = ./dwm.nix;

View file

@ -1,18 +1,5 @@
_:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.local.X11Programs;
in
{
options.local.X11Programs = {
sxhkd.enable = lib.mkEnableOption "";
};
config = lib.mkMerge [
{ pkgs, lib, ... }:
{
services.xserver = {
tty = lib.mkDefault 1;
@ -23,52 +10,5 @@ in
excludePackages = [ pkgs.xterm ];
desktopManager.xterm.enable = false;
};
}
(
let
configFile = pkgs.writeText "sxhkdrc" ''
XF86AudioPlay
playerctl play-pause
XF86AudioPause
playerctl play-pause
XF86AudioStop
playerctl stop
XF86AudioNext
playerctl next
XF86AudioPrev
playerctl previous
XF86AudioRaiseVolume
amixer sset Master 40+
XF86AudioLowerVolume
amixer sset Master 40-
XF86AudioMute
amixer sset Master toggle
XF86MonBrightnessUp
brightnessctl s 20+
XF86MonBrightnessDown
brightnessctl s 20-
Print
maim $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg
Print + shift
maim | xclip -selection clipboard -t image/png
super + Print
maim -s $HOME/Screenshots/$(date +%Y-%m-%d_%H-%m-%s).jpg
super + Print + shift
maim -s | xclip -selection clipboard -t image/png
'';
in
lib.mkIf cfg.sxhkd.enable {
environment.systemPackages = [
pkgs.maim # screenshooter
pkgs.brightnessctl # brightness control for laptop
pkgs.playerctl # music control
pkgs.xclip
];
services.xserver.displayManager.sessionCommands = ''
${lib.getExe' pkgs.sxhkd "sxhkd"} -c ${configFile} &
'';
}
)
];
_file = ./X11.nix;
}