From 2bd188a33a22c491feba102e2308084eda81b476 Mon Sep 17 00:00:00 2001 From: Nickiel12 Date: Sat, 8 Oct 2022 18:52:26 -0700 Subject: [PATCH] added kmonad --- configuration.nix | 22 ++++++++++++++++++---- flake.lock | 39 ++++++++++++++++++++++++++++++++++++++- flake.nix | 5 ++++- rsrcs/keyboard.kbd | 18 ++++++++++++++++++ 4 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 rsrcs/keyboard.kbd diff --git a/configuration.nix b/configuration.nix index 461a2ce..38cafb7 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,13 +2,13 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, ... }: +{ config, lib, pkgs, inputs, ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix - ./kmonad-module.nix + # ./kmonad-module.nix ]; # nixpkgs.config.allowBroken = true; @@ -54,8 +54,16 @@ # Configure keymap in X11 services.xserver.layout = "us"; services.xserver.xkbOptions = "caps:super"; - services.kmonad.enable = true; + services.kmonad = { + enable = true; + config = builtins.readFile ./rsrcs/keyboard.kbd; + defcfg = { + enable = true; + fallthrough = true; + }; + }; + nixpkgs.config.allowUnfree = true; # Enable CUPS to print documents. @@ -86,7 +94,7 @@ # Define a user account. Don't forget to set a password with ‘passwd’. users.users.nixolas = { isNormalUser = true; - extraGroups = [ "wheel" "video" "audio" "networkmanager" "lp" "scanner" ]; # Enable ‘sudo’ for the user. + extraGroups = [ "wheel" "video" "audio" "networkmanager" "lp" "scanner" "input" "uinput" ]; # Enable ‘sudo’ for the user. shell = pkgs.zsh; password = "password"; }; @@ -112,6 +120,12 @@ extraOptions = "experimental-features = nix-command flakes"; }; + services.udev.extraRules = + '' + # KMonad user access to /dev/uinput + KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput" + ''; + # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; diff --git a/flake.lock b/flake.lock index 6a8dfd7..828bbac 100644 --- a/flake.lock +++ b/flake.lock @@ -21,7 +21,43 @@ "type": "github" } }, + "kmonad": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "dir": "nix", + "lastModified": 1664950533, + "narHash": "sha256-TooqJDgGNyyhpIGB8U28Y3poYUFW4jeH9h59D7cKSls=", + "owner": "kmonad", + "repo": "kmonad", + "rev": "af8c2253754882b5b50c824ce9906d35f9b95657", + "type": "github" + }, + "original": { + "dir": "nix", + "owner": "kmonad", + "repo": "kmonad", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1653326962, + "narHash": "sha256-W8feCYqKTsMre4nAEpv5Kx1PVFC+hao/LwqtB2Wci/8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "41cc1d5d9584103be4108c1815c350e07c807036", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1665081174, "narHash": "sha256-6hsmzdhdy8Kbvl5e0xZNE83pW3fKQvNiobJkM6KQrgA=", @@ -40,7 +76,8 @@ "root": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs" + "kmonad": "kmonad", + "nixpkgs": "nixpkgs_2" } }, "utils": { diff --git a/flake.nix b/flake.nix index 805b821..4b1d5f0 100644 --- a/flake.nix +++ b/flake.nix @@ -7,9 +7,11 @@ url = github:nix-community/home-manager; inputs.nixpkgs.follows = "nixpkgs"; }; + + kmonad.url = "github:kmonad/kmonad?dir=nix"; }; - outputs = { self, nixpkgs, home-manager }: + outputs = { self, nixpkgs, home-manager, kmonad }: let user = "nixolas"; system = "x86_64-linux"; @@ -26,6 +28,7 @@ specialArgs = { inherit user; }; modules = [ ./configuration.nix + kmonad.nixosModules.default home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; diff --git a/rsrcs/keyboard.kbd b/rsrcs/keyboard.kbd new file mode 100644 index 0000000..ce862cf --- /dev/null +++ b/rsrcs/keyboard.kbd @@ -0,0 +1,18 @@ +(defalias cc (tap-next esc lmet)) +(defalias qw (layer-switch qwerty)) + +(defsrc + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] \ + caps a s d f g h j k l ; ' ret + lsft z x c v b n m , . / rsft + lctl lmet lalt spc ralt cmp rctl +) + +(deflayer qwerty + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] \ + @cc a s d f g h j k l ; ' ret + lsft z x c v b n m , . / rsft + lctl lmet lalt spc ralt rctl @qw +)