-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyboard.nix
96 lines (88 loc) · 3.12 KB
/
keyboard.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{ config, lib, pkgs, inputs, ... }:
{
imports = [ inputs.kmonad.nixosModules.default ];
environment.systemPackages = with pkgs; [ keyd moused via vial ];
services.udev.packages = with pkgs; [ via ];
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c52b", ATTR{power/autosuspend}="60"
'';
hardware.keyboard.qmk.enable = true;
systemd.services.keyd = {
enable = true;
description = "key remapping daemon";
wantedBy = [ "sysinit.target" ];
requires = [ "local-fs.target" ];
after = [ "local-fs.target" ];
reloadTriggers = [ ./keyboard ];
serviceConfig.type = "simple";
script = "${pkgs.keyd}/bin/keyd";
path = with pkgs; [ ddcutil ];
};
systemd.services.moused = {
enable = false;
description = "mouse remapping daemon";
wantedBy = [ "sysinit.target" ];
requires = [ "local-fs.target" ];
after = [ "local-fs.target" ];
reloadTriggers = [ ./keyboard/mouse.conf ];
serviceConfig.type = "simple";
script = "${pkgs.moused}/bin/moused -f";
};
users.extraGroups.keyd = { };
environment.etc."keyd/all-keyboards.conf".source =
./keyboard/all-keyboards.conf;
environment.etc."keyd/monsgeek.conf".source = ./keyboard/monsgeek.conf;
environment.etc."keyd/zoom65.conf".source = ./keyboard/zoom65.conf;
environment.etc."keyd/common".source = ./keyboard/common.conf;
environment.etc."moused.conf".source = ./keyboard/mouse.conf;
nixpkgs.overlays = [
(self: super: {
keyd-custom = super.keyd.overrideAttrs (old: {
src = builtins.fetchurl {
url =
"https://github.com/rvaiya/keyd/archive/04c9e15d70fe1019dc5a38359540270caf86cfcb.tar.gz";
sha256 = "171nrzrp1z8iiqh8x4cx3g0pxgnzxfidsrjwmaiiqb299d741biq";
};
buildInputs = old.buildInputs
++ [ (pkgs.writeShellScriptBin "git" ''echo "04c9e"'') ];
postPatch = ''
export DESTDIR=${placeholder "out"}
substituteInPlace Makefile \
--replace DESTDIR= DESTDIR=${placeholder "out"} \
--replace /usr ""
substituteInPlace keyd.service \
--replace /usr/bin $out/bin
'';
});
moused = self.stdenv.mkDerivation {
pname = "moused";
version = "1";
src = self.fetchFromGitHub {
owner = "rvaiya";
repo = "moused";
rev = "67275498908bbdfab3ea35151a9f54ed232e206d";
hash = "sha256-nJTK+HoFAkMv90e6kMB/ZWcplenz7Vov+Rg1DyW9cFc=";
};
buildInputs = with pkgs; [ udev ];
enableParallelBuilding = true;
postPatch = ''
mkdir -p $out/bin
substituteInPlace Makefile \
--replace /usr ${placeholder "out"} \
--replace /etc ${placeholder "out"}/etc
'';
postInstall = "rm -rf $out/etc";
};
})
];
# nixpkgs.overlays = [
# (self: super: {
# keyd = super.keyd.overrideAttrs (old: {
# src = builtins.fetchGit {
# url = "https://github.com/rvaiya/keyd";
# rev = "04c9e15d70fe1019dc5a38359540270caf86cfcb";
# };
# });
# })
# ];
}