From 0bd68f9e2104e7a44bb06f901b74d5eb6a09ee08 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Sun, 19 Feb 2023 22:47:42 +0100 Subject: [PATCH] Added slambda module! --- flake.lock | 36 ++++++++++++- flake.nix | 4 ++ hosts/nixos/common/global/default.nix | 1 + hosts/nixos/common/optional/slambda.nix | 67 +++++++++++++++++++++++++ hosts/nixos/tethys/default.nix | 2 +- 5 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 hosts/nixos/common/optional/slambda.nix diff --git a/flake.lock b/flake.lock index d778abe..0323a71 100644 --- a/flake.lock +++ b/flake.lock @@ -87,6 +87,21 @@ "type": "github" } }, + "flake-utils_2": { + "locked": { + "lastModified": 1648297722, + "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -215,7 +230,8 @@ "impermanence": "impermanence", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixpkgs": "nixpkgs", - "rosepine-base16": "rosepine-base16" + "rosepine-base16": "rosepine-base16", + "slambda": "slambda" } }, "rosepine-base16": { @@ -234,6 +250,24 @@ "type": "github" } }, + "slambda": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1676842959, + "narHash": "sha256-GulJ8tlS1g+LSxqhTxrao6Tf2nU/cqnLb7ilCbNyznE=", + "path": "/home/adrielus/Projects/python-keyboard-fuckery", + "type": "path" + }, + "original": { + "path": "/home/adrielus/Projects/python-keyboard-fuckery", + "type": "path" + } + }, "utils": { "locked": { "lastModified": 1667395993, diff --git a/flake.nix b/flake.nix index 326a515..83e2790 100644 --- a/flake.nix +++ b/flake.nix @@ -32,6 +32,10 @@ # Impermanence impermanence.url = "github:nix-community/impermanence"; + # Slambda + slambda.url = "path:/home/adrielus/Projects/python-keyboard-fuckery"; + slambda.inputs.nixpkgs.follows = "nixpkgs"; + # Neovim nightly neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; neovim-nightly-overlay.inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/nixos/common/global/default.nix b/hosts/nixos/common/global/default.nix index ce5fdfe..b0236fe 100644 --- a/hosts/nixos/common/global/default.nix +++ b/hosts/nixos/common/global/default.nix @@ -4,6 +4,7 @@ let imports = [ inputs.agenix.nixosModule inputs.base16.nixosModule + inputs.slambda.nixosModule # inputs.impermanence.nixosModule ./nix.nix diff --git a/hosts/nixos/common/optional/slambda.nix b/hosts/nixos/common/optional/slambda.nix new file mode 100644 index 0000000..1778213 --- /dev/null +++ b/hosts/nixos/common/optional/slambda.nix @@ -0,0 +1,67 @@ +let + chord = from: to: { inherit from to; }; + unmap = from: chord from [ ]; + commonChords = [ + # {{{ Modifiers + (chord [ "s" "d" ] [ "leftshift" ]) + (chord [ "k" "l" ] [ "rightshift" ]) + (chord [ "s" "f" ] [ "leftctrl" ]) + (chord [ "j" "l" ] [ "rightctrl" ]) + (chord [ "j" "k" "l" ] [ "rightctrl" "rightshift" ]) + (chord [ "s" "d" "f" ] [ "leftctrl" "leftshift" ]) + (chord [ "n" "l" ] [ "leftmeta" ]) + (unmap [ "leftmeta" ]) + (unmap [ "leftshift" ]) + (unmap [ "leftctrl" ]) + # }}} + # {{{ Other special keys + (chord [ "g" "h" ] [ "backspace" ]) + (chord [ "n" "v" ] [ "backslash" ]) + (chord [ "d" "f" ] [ "tab" ]) + (chord [ "e" "f" ] [ "enter" ]) + (chord [ "q" "w" ] [ "esc" ]) + (unmap [ "backspace" ]) + (unmap [ "enter" ]) + (unmap [ "tab" ]) + (unmap [ "esc" ]) + (unmap [ "backslash" ]) + # }}} + # {{{ Tmux + (chord [ "a" "n" "k" "l" ] [ "rightshift" "a" "n" ]) # Next tab in tmux + (chord [ "a" "j" "l" ] [ "rightshift" "a" ]) # Tmux leader + # }}} + # {{{ WM keybinds + (chord [ "n" "l" "q" ] [ "leftmeta" "1" ]) + (chord [ "n" "l" "w" ] [ "leftmeta" "2" ]) + (chord [ "n" "l" "e" ] [ "leftmeta" "3" ]) + (chord [ "n" "l" "r" ] [ "leftmeta" "4" ]) + (chord [ "n" "l" "a" ] [ "leftmeta" "5" ]) + (chord [ "n" "l" "s" ] [ "leftmeta" "6" ]) + (chord [ "n" "l" "d" ] [ "leftmeta" "7" ]) + (chord [ "n" "l" "f" ] [ "leftmeta" "8" ]) + (chord [ "n" "k" "l" ] [ "leftmeta" "p" ]) + # }}} + # {{{ Handled by vim + (chord [ "j" "k" ] [ "f10" ]) + (chord [ "c" "p" ] [ "f11" ]) + (chord [ "j" "i" ] [ "f12" ]) + # }}} + ]; +in +{ + services.slambda = { + enable = true; + + keyboards.keychronK6 = { + delay = 25; + device = "/dev/input/by-id/usb-Keychron_Keychron_K6-event-kbd"; + chords = commonChords; + }; + + keyboards.tethysLaptop = { + delay = 25; + device = "/dev/input/by-path/platform-i8042-serio-0-event-kbd"; + chords = commonChords; + }; + }; +} diff --git a/hosts/nixos/tethys/default.nix b/hosts/nixos/tethys/default.nix index daf18d9..d0cde0e 100644 --- a/hosts/nixos/tethys/default.nix +++ b/hosts/nixos/tethys/default.nix @@ -8,6 +8,7 @@ ../common/optional/xserver.nix ../common/optional/gdm.nix ../common/optional/xmonad + ../common/optional/slambda.nix ./hardware-configuration.nix ./boot.nix @@ -18,7 +19,6 @@ # A few ad-hoc settings hardware.opengl.enable = true; programs.kdeconnect.enable = true; - # i18n.inputMethod.enabled = "uim"; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = "22.11";