From 8c027300e6fe63d3f59f61d7f60c2fdc975afd90 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 16 May 2023 17:18:06 -0400 Subject: [PATCH] Modularize htop and dual-function-keys --- configuration.nix | 31 ++----------------------------- modules/dual-function-keys.nix | 27 +++++++++++++++++++++++++++ modules/htop.nix | 9 +++++++++ 3 files changed, 38 insertions(+), 29 deletions(-) create mode 100644 modules/dual-function-keys.nix create mode 100644 modules/htop.nix diff --git a/configuration.nix b/configuration.nix index 3bde14e6..f15a07f9 100644 --- a/configuration.nix +++ b/configuration.nix @@ -7,6 +7,8 @@ ./modules/fish.nix ./modules/fonts.nix ./modules/stylix + ./modules/htop.nix + ./modules/dual-function-keys.nix ]; boot.loader.systemd-boot.enable = true; @@ -87,11 +89,6 @@ programs.thunar.enable = true; programs.neovim.enable = true; - programs.htop = { - enable = true; - package = pkgs."htop-vim"; - settings = { tree_view = 1; }; - }; programs.firejail.enable = true; nix.package = pkgs.nixFlakes; nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -186,29 +183,5 @@ networking.nat.internalInterfaces = [ "ve-+" ]; networking.nat.externalInterface = "wg-mullvad"; - services.interception-tools = { - enable = true; - plugins = [ pkgs.interception-tools-plugins.dual-function-keys ]; - udevmonConfig = '' - - JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c /etc/dual-function-keys.yaml | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE" - DEVICE: - EVENTS: - EV_KEY: [KEY_CAPSLOCK, KEY_ESC] - ''; - }; - - environment.etc."dual-function-keys.yaml".text = '' - TIMING: - - TAP_MILLISEC: 1000 - - DOUBLE_TAP_MILLISEC: 0 - MAPPINGS: - - KEY: KEY_CAPSLOCK - TAP: KEY_ESC - HOLD: KEY_LEFTCTRL - - KEY: KEY_SYSRQ - TAP: KEY_SYSRQ - HOLD: KEY_RIGHTMETA - ''; - system.stateVersion = "22.11"; } diff --git a/modules/dual-function-keys.nix b/modules/dual-function-keys.nix new file mode 100644 index 00000000..dc14ae13 --- /dev/null +++ b/modules/dual-function-keys.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: + +{ + services.interception-tools = { + enable = true; + plugins = [ pkgs.interception-tools-plugins.dual-function-keys ]; + udevmonConfig = '' + - JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c /etc/dual-function-keys.yaml | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE" + DEVICE: + EVENTS: + EV_KEY: [KEY_CAPSLOCK, KEY_ESC] + ''; + }; + + environment.etc."dual-function-keys.yaml".text = '' + TIMING: + - TAP_MILLISEC: 1000 + - DOUBLE_TAP_MILLISEC: 0 + MAPPINGS: + - KEY: KEY_CAPSLOCK + TAP: KEY_ESC + HOLD: KEY_LEFTCTRL + - KEY: KEY_SYSRQ + TAP: KEY_SYSRQ + HOLD: KEY_RIGHTMETA + ''; +} diff --git a/modules/htop.nix b/modules/htop.nix new file mode 100644 index 00000000..bfffa9f0 --- /dev/null +++ b/modules/htop.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +{ + programs.htop = { + enable = true; + package = pkgs."htop-vim"; + settings = { tree_view = 1; }; + }; +}