-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
109 lines (98 loc) · 3.43 KB
/
flake.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
97
98
99
100
101
102
103
104
105
106
107
108
109
{
description = "My keyboard firmware";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
kaleidoscope = {
url = "github:keyboardio/Kaleidoscope";
flake = false;
};
keymap-drawer-src = {
url = "github:caksoylar/keymap-drawer";
flake = false;
};
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
kaleidoscope,
keymap-drawer-src,
poetry2nix,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem
(
system: let
overlay = nixpkgs.lib.composeManyExtensions [
poetry2nix.overlays.default
(final: prev: {
keymap-drawer = prev.poetry2nix.mkPoetryApplication {
projectDir = keymap-drawer-src;
overrides =
prev.poetry2nix.defaultPoetryOverrides.extend
(self: super: {
deptry =
super.deptry.overridePythonAttrs
(
old: {
buildInputs = (old.buildInputs or []) ++ [super.poetry];
}
);
});
};
})
];
pkgs = import nixpkgs {
inherit system;
overlays = [overlay];
};
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
arduino-cli
clang-tools
git
hid-listen # For keylogging
qmk
vial
];
shellHook = let
kaleidoscopeSetup = ''
export KALEIDOSCOPE_DIR=${kaleidoscope}
export ARDUINO_DIRECTORIES_USER=/tmp/arduino/user
export ARDUINO_DIRECTORIES_DATA=/tmp/arduino/data
export ARDUINO_DIRECTORIES_DOWNLOADS=/tmp/arduino/downloads
make -f ${kaleidoscope}/Makefile setup
export PATH="${kaleidoscope}/bin:${pkgs.keymap-drawer}/bin:$PATH"
'';
qmkSetup = ''
export QMK_HOME=/tmp/qmk_firmware
qmk setup -y
rm -rf /tmp/qmk_firmware/.build
rm -rf /tmp/qmk_firmware/keyboards/keyboardio
ln -fs ${self}/QMK/keyboards/* /tmp/qmk_firmware/keyboards
ln -fs ${self}/QMK/users/* /tmp/qmk_firmware/users
'';
vialSetup = ''
alias vial-qmk='env QMK_HOME=/tmp/vial_firmware qmk'
vial-qmk setup svalboard/vial-qmk -b vial -y
rm -rf /tmp/vial_firmware/.build
rm -rf /tmp/vial_firmware/keyboards/svalboard/keymaps/SiriusStarr
ln -fs ${self}/Vial/keyboards/svalboard/keymaps/SiriusStarr /tmp/vial_firmware/keyboards/svalboard/keymaps/SiriusStarr
rm -rf /tmp/vial_firmware/users/SiriusStarr
mkdir /tmp/vial_firmware/users/SiriusStarr
ln -fs ${self}/QMK/users/SiriusStarr/defs /tmp/vial_firmware/users/SiriusStarr/
ln -fs ${self}/QMK/users/SiriusStarr/extensions /tmp/vial_firmware/users/SiriusStarr/
ln -fs ${self}/QMK/users/SiriusStarr/* /tmp/vial_firmware/users/SiriusStarr/
ln -fs ${self}/Vial/users/SiriusStarr/rules.mk /tmp/vial_firmware/users/SiriusStarr/
'';
in
kaleidoscopeSetup + vialSetup + qmkSetup;
};
}
);
}