From 8fc757c678ae6b89ea4289a108613bcef94dc70d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 14 Jan 2020 06:57:36 -0500 Subject: [PATCH] Move hardware config to modules --- machines/kuro.nix | 28 +++++++++------------------- modules/hardware/ergodox.nix | 6 ++++++ modules/hardware/nvidia.nix | 14 ++++++++++++++ modules/hardware/tablet.nix | 16 ++++++++++++++++ 4 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 modules/hardware/ergodox.nix create mode 100644 modules/hardware/nvidia.nix create mode 100644 modules/hardware/tablet.nix diff --git a/machines/kuro.nix b/machines/kuro.nix index 58e13572..0fdee1a1 100644 --- a/machines/kuro.nix +++ b/machines/kuro.nix @@ -5,6 +5,9 @@ imports = [ ./. # import common settings + + + # discord, mainly @@ -36,23 +39,10 @@ networking.networkmanager.enable = true; time.timeZone = "America/Toronto"; - ## Hardware - # GPU - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.opengl.enable = true; - # For ergodox ez - my.packages = [ pkgs.teensy-loader-cli ]; - my.alias.teensyload = "sudo teensy-loader-cli -w -v --mcu=atmega32u4"; - # For my intuos4 pro. My cintiq doesn't work on Linux though :( - services.xserver.wacom.enable = true; - - # TODO Move this to udev - # my.init = '' - # # lock tablet to main display - # if xinput list --id-only "Wacom Intuos Pro S Pen stylus" 2>&1 >/dev/null; then - # xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen stylus") DVI-I-1 - # xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen eraser") DVI-I-1 - # xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen cursor") DVI-I-1 - # fi - # ''; + # Mouse settings + services.xserver.libinput = { + enable = true; + middleEmulation = true; + scrollButton = 3; + }; } diff --git a/modules/hardware/ergodox.nix b/modules/hardware/ergodox.nix new file mode 100644 index 00000000..c87d225b --- /dev/null +++ b/modules/hardware/ergodox.nix @@ -0,0 +1,6 @@ +{ config, lib, pkgs, ... }: + +{ + my.packages = [ pkgs.teensy-loader-cli ]; + my.alias.teensyload = "sudo teensy-loader-cli -w -v --mcu=atmega32u4"; +} diff --git a/modules/hardware/nvidia.nix b/modules/hardware/nvidia.nix new file mode 100644 index 00000000..28648b82 --- /dev/null +++ b/modules/hardware/nvidia.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, ... }: + +{ + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.opengl.enable = true; + + # Respect XDG conventions, damn it! + environment.systemPackages = with pkgs; [ + (pkgs.writeScriptBin "nvidia-settings" '' + #!${pkgs.stdenv.shell} + exec ${config.boot.kernelPackages.nvidia_x11}/bin/nvidia-settings --config="$XDG_CONFIG_HOME/nvidia/settings" + '') + ]; +} diff --git a/modules/hardware/tablet.nix b/modules/hardware/tablet.nix new file mode 100644 index 00000000..994f9aa2 --- /dev/null +++ b/modules/hardware/tablet.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +{ + # For my intuos4 pro. Doesn't work for cintiqs. + services.xserver.wacom.enable = true; + + # TODO Move this to udev + # my.init = '' + # # lock tablet to main display + # if xinput list --id-only "Wacom Intuos Pro S Pen stylus" 2>&1 >/dev/null; then + # xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen stylus") DVI-I-1 + # xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen eraser") DVI-I-1 + # xinput map-to-output $(xinput list --id-only "Wacom Intuos Pro S Pen cursor") DVI-I-1 + # fi + # ''; +}