blob: 807a57cd352c99d6e9d50c6410813b29f0392614 (
plain) (
blame)
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
|
{
stdenv,
fetchgit,
# deps
qmk,
gnumake,
}: let
layout_id = "KWBYA";
layout_geometry = "moonlander";
FIRMWARE_VERSION = "24";
in
stdenv.mkDerivation
{
pname = "moonlander-layout";
version = "25";
src = fetchgit {
url = "https://github.com/zsa/qmk_firmware";
rev = "4ae6ea9679fbd4277caa1036d326ddfce278b4d2"; # 2024-12-09T17:43:04 CET
hash = "sha256-c+fojw64dHIYoO20cO9Nd1pnQwBDPPbrh6Erf9QTyGw=";
fetchSubmodules = true;
};
nativeBuildInputs = [
gnumake
qmk
];
buildPhase =
/*
bash
*/
''
runHook preBuild
## Set keyboard directory and make prefix based on firmware version
if [ "${FIRMWARE_VERSION}" -ge 24 ]; then
keyboard_directory="keyboards/zsa"
keyboard_folder="zsa/${layout_geometry}"
else
keyboard_directory="keyboards"
keyboard_folder="${layout_geometry}"
fi
## Copy layout files to the qmk folder
key_dir="$keyboard_directory/${layout_geometry}/keymaps/${layout_id}"
[ -d "$key_dir" ] && rm --recursive "$key_dir"
mkdir --parents "$(dirname "$key_dir")"
cp --recursive "${./src}" "$key_dir"
## Build the layout
# qmk setup "zsa/qmk_firmware" -b 'firmware${FIRMWARE_VERSION}' -y
make "$keyboard_folder:${layout_id}"
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir --parents "$out/binary_output"
cp "./.build/zsa_moonlander_${layout_id}.bin" "$out/binary_output/"
runHook postInstall
'';
}
|