default.nix (1406B)
1 { sources ? import ../../nix 2 , lib ? sources.lib 3 , pkgs ? sources.nixpkgs { } 4 }: 5 6 with pkgs; 7 let avrlibc = pkgsCross.avr.libcCross; in 8 rec { 9 qmkSource = fetchgit { 10 url = "https://github.com/qmk/qmk_firmware"; 11 rev = "0.10.50"; 12 sha256 = "162rvhqyx25fz39395vhhk3allbfn4bd8c1afj8ip9r27zwnqrwd"; 13 fetchSubmodules = true; 14 }; 15 16 layout = stdenv.mkDerivation rec { 17 name = "ergodox_ez_sbr.hex"; 18 19 src = qmkSource; 20 21 buildInputs = [ 22 dfu-programmer 23 dfu-util 24 diffutils 25 git 26 python3 27 pkgsCross.avr.buildPackages.binutils 28 pkgsCross.avr.buildPackages.gcc8 29 avrlibc 30 avrdude 31 ]; 32 33 AVR_CFLAGS = [ 34 "-isystem ${avrlibc}/avr/include" 35 "-L${avrlibc}/avr/lib/avr5" 36 ]; 37 38 AVR_ASFLAGS = AVR_CFLAGS; 39 40 patches = [ ./increase-tapping-delay.patch ]; 41 42 postPatch = '' 43 mkdir keyboards/ergodox_ez/keymaps/sbr 44 cp ${./keymap.c} keyboards/ergodox_ez/keymaps/sbr/keymap.c 45 cp ${./config.h} keyboards/ergodox_ez/keymaps/sbr/config.h 46 cp ${./rules.mk} keyboards/ergodox_ez/keymaps/sbr/rules.mk 47 ''; 48 49 buildPhase = '' 50 make ergodox_ez:sbr 51 ''; 52 53 installPhase = '' 54 cp ergodox_ez_sbr.hex $out 55 ''; 56 }; 57 58 flash = writeShellScript "flash.sh" '' 59 ${teensy-loader-cli}/bin/teensy-loader-cli \ 60 -v \ 61 --mcu=atmega32u4 \ 62 -w ${layout} 63 ''; 64 65 meta.targets = [ "layout" ]; 66 }