2022-07-31 11:03:59 +02:00
|
|
|
{qmk}: {
|
|
|
|
avr ? true,
|
|
|
|
arm ? true,
|
|
|
|
teensy ? true,
|
|
|
|
pkgsCross,
|
|
|
|
mkShell,
|
|
|
|
lib,
|
|
|
|
poetry2nix,
|
|
|
|
stdenv,
|
|
|
|
fetchurl,
|
|
|
|
fetchFromGitHub,
|
|
|
|
clang-tools,
|
|
|
|
dfu-programmer,
|
|
|
|
dfu-util,
|
|
|
|
diffutils,
|
|
|
|
git,
|
|
|
|
which,
|
|
|
|
avrBinutils' ? pkgsCross.avr.buildPackages.binutils,
|
|
|
|
avrGcc' ? pkgsCross.avr.buildPackages.gcc8,
|
|
|
|
avrlibc' ? pkgsCross.avr.libcCross,
|
|
|
|
avrdude,
|
|
|
|
gcc-arm-embedded,
|
|
|
|
teensy-loader-cli,
|
|
|
|
libusb-compat-0_1,
|
|
|
|
}: let
|
2021-11-04 00:01:27 +01:00
|
|
|
avr_incflags = [
|
|
|
|
"-isystem ${avrlibc'}/avr/include"
|
|
|
|
"-B${avrlibc'}/avr/lib/avr5"
|
|
|
|
"-L${avrlibc'}/avr/lib/avr5"
|
|
|
|
"-B${avrlibc'}/avr/lib/avr35"
|
|
|
|
"-L${avrlibc'}/avr/lib/avr35"
|
|
|
|
"-B${avrlibc'}/avr/lib/avr51"
|
|
|
|
"-L${avrlibc'}/avr/lib/avr51"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonEnv = poetry2nix.mkPoetryEnv {
|
|
|
|
projectDir = "${qmk}/util/nix";
|
|
|
|
overrides = poetry2nix.overrides.withDefaults (self: super: {
|
2022-07-31 11:03:59 +02:00
|
|
|
qmk = super.qmk.overridePythonAttrs (old: {
|
2021-11-04 00:01:27 +01:00
|
|
|
# Allow QMK CLI to run "bin/qmk" as a subprocess (the wrapper changes
|
|
|
|
# $PATH and breaks these invocations).
|
|
|
|
dontWrapPythonPrograms = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
2022-07-31 11:03:59 +02:00
|
|
|
in rec {
|
2021-11-04 00:01:27 +01:00
|
|
|
bootloadhid = stdenv.mkDerivation rec {
|
|
|
|
pname = "bootloadhid";
|
|
|
|
version = "2012-12-08";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz";
|
|
|
|
sha256 = "sha256-FU5+OGKaOi7sLfZm7foe4vLppXAY8X2fD48GTMINh1Q=";
|
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = "bootloadHID.${version}/commandline";
|
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
nativeBuildInputs = [libusb-compat-0_1.dev];
|
2021-11-04 00:01:27 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp bootloadHID $out/bin
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
shell = mkShell {
|
|
|
|
name = "qmk-devshell";
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[clang-tools dfu-programmer dfu-util diffutils git pythonEnv bootloadhid]
|
|
|
|
++ lib.optional avr [
|
|
|
|
avrBinutils'
|
|
|
|
avrGcc'
|
|
|
|
avrlibc'
|
|
|
|
avrdude
|
|
|
|
]
|
|
|
|
++ lib.optional arm [gcc-arm-embedded]
|
|
|
|
++ lib.optional teensy [teensy-loader-cli];
|
|
|
|
|
|
|
|
AVR_CFLAGS = lib.optional avr avr_incflags;
|
|
|
|
AVR_ASFLAGS = lib.optional avr avr_incflags;
|
|
|
|
shellHook = ''
|
|
|
|
# Prevent the avr-gcc wrapper from picking up host GCC flags
|
|
|
|
# like -iframework, which is problematic on Darwin
|
|
|
|
unset NIX_CFLAGS_COMPILE_FOR_TARGET
|
|
|
|
'';
|
|
|
|
};
|
2021-11-04 00:01:27 +01:00
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
qmk-firmware = stdenv.mkDerivation {
|
|
|
|
name = "qmk-firmware";
|
2021-11-04 00:01:27 +01:00
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "qmk";
|
|
|
|
repo = "qmk_firmware";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
leaveDotGit = true;
|
|
|
|
sha256 = "sha256-bd+NOzwqQCDBw2FYYtGWpmja0tFhsfpdDFyZXlSM/U4=";
|
|
|
|
rev = "0.16.5";
|
2021-11-04 00:01:27 +01:00
|
|
|
};
|
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
configurePhase = ''
|
|
|
|
mkdir -p keyboards/mt/split75/keymaps/custom
|
|
|
|
cp ${./keymap.c} keyboards/mt/split75/keymaps/custom/keymap.c
|
|
|
|
cp ${./rules.mk} keyboards/mt/split75/rules.mk
|
|
|
|
cp ${./config.h} keyboards/mt/split75/keymaps/custom/config.h
|
|
|
|
'';
|
2021-11-04 00:01:27 +01:00
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
buildPhase = ''
|
|
|
|
make mt/split75:custom
|
|
|
|
'';
|
2021-11-04 00:01:27 +01:00
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
nativeBuildInputs =
|
|
|
|
[clang-tools dfu-programmer dfu-util diffutils git pythonEnv bootloadhid which]
|
|
|
|
++ lib.optional avr [
|
|
|
|
avrBinutils'
|
|
|
|
avrGcc'
|
|
|
|
avrlibc'
|
|
|
|
avrdude
|
|
|
|
]
|
|
|
|
++ lib.optional arm [gcc-arm-embedded]
|
|
|
|
++ lib.optional teensy [teensy-loader-cli];
|
|
|
|
AVR_CFLAGS = lib.optional avr avr_incflags;
|
|
|
|
AVR_ASFLAGS = lib.optional avr avr_incflags;
|
|
|
|
shellHook = ''
|
|
|
|
# Prevent the avr-gcc wrapper from picking up host GCC flags
|
|
|
|
# like -iframework, which is problematic on Darwin
|
|
|
|
unset NIX_CFLAGS_COMPILE_FOR_TARGET
|
|
|
|
'';
|
2021-11-04 00:01:27 +01:00
|
|
|
|
2022-07-31 11:03:59 +02:00
|
|
|
installPhase = ''
|
|
|
|
cp wheatfield_split75_custom.hex $out
|
|
|
|
'';
|
|
|
|
};
|
2021-11-04 00:01:27 +01:00
|
|
|
}
|