From 7aa390883104725c64c65d20a0713cfcd654f637 Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Tue, 21 Oct 2025 10:38:26 -0500 Subject: More correct dfu-util flash script + rearranged personal devices --- modules/qmk.nix | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'modules/qmk.nix') diff --git a/modules/qmk.nix b/modules/qmk.nix index c083b06..3834369 100644 --- a/modules/qmk.nix +++ b/modules/qmk.nix @@ -73,6 +73,8 @@ in { name = "qmk:${config.qmk.keyboard._path}:${config.qmk.keymap.name}"; src = config.qmk.qmk_firmware; + allowSubstitutes = false; + # hardeningDisable = [ "pic" "pie" ]; nativeBuildInputs = [ @@ -81,22 +83,23 @@ in { # dontFixup = true; - preBuild = lib.optionalString (ksrc != null) '' + postPatch = lib.optionalString (ksrc != null) /* bash */ '' mkdir -pv "${config.qmk.keymap._path}" cp -v "${ksrc}"/* "${config.qmk.keymap._path}" ''; - buildPhase = '' - # SKIP_GIT=true BUILD_DIR=build \ - # make "${config.qmk.keyboard._path}:${config.qmk.keymap.name}" - qmk compile \ - --env SKIP_GIT=yes \ - --env BUILD_DIR=build \ - --env SKIP_VERSION=yes \ - --env VERBOSE=true \ - --env ALLOW_WARNINGS=yes \ - --keyboard "${config.qmk.keyboard._path}" \ - --keymap "${config.qmk.keymap.name}" + buildPhase = /* bash */ '' + runHook preBuild + + qmk compile \ + --env SKIP_GIT=yes \ + --env BUILD_DIR=build \ + --env SKIP_VERSION=yes \ + --env VERBOSE=true \ + --keyboard "${config.qmk.keyboard._path}" \ + --keymap "${config.qmk.keymap.name}" + + runHook postBuild ''; installPhase = '' @@ -108,7 +111,10 @@ in { }; }; flash = mkOption { - type = types.functionTo (types.either types.package types.str); + type = types.functionTo <| types.either types.package types.str; + default = hex: '' + "${pkgs.dfu-util}/bin/dfu-util" --alt 0 --dfuse-address 0x08000000:leave -D "${hex}.hex" + ''; }; }; -- cgit v1.2.3