aboutsummaryrefslogtreecommitdiff
path: root/modules/qmk.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/qmk.nix')
-rw-r--r--modules/qmk.nix32
1 files changed, 19 insertions, 13 deletions
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"
+ '';
};
};