about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-06T22·12-0400
committerglittershark <grfn@gws.fyi>2020-07-06T22·52+0000
commit9ec0f4d0c822b63c807ecf869299dc25836b6c03 (patch)
tree07e21f44c33660f671a41354bcf50de185f4364a
parentaae3d25234cea89b69824a6ed8b7994350a32247 (diff)
feat(gs/keyboard): Integrate my layout with the depot r/1231
Integrate the keyboard layout for my Ergodox EZ, which is a layout for
QMK, with the depot, including exposing several cross-compilation
packages necessary to compile qmk for avr in third_party.

Change-Id: Idd43169a0a3cf0be2bd1a578fdaff70388a58bfc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/947
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
-rw-r--r--ci-builds.nix1
-rw-r--r--third_party/default.nix7
-rw-r--r--users/glittershark/keyboard/default.nix34
-rwxr-xr-xusers/glittershark/keyboard/flash2
4 files changed, 32 insertions, 12 deletions
diff --git a/ci-builds.nix b/ci-builds.nix
index 437804eef9..64291f4951 100644
--- a/ci-builds.nix
+++ b/ci-builds.nix
@@ -101,5 +101,6 @@ in lib.fix (self: {
   glittershark = with depot.users.glittershark; [
     (systemFor system.system.chupacabra)
     xanthous
+    keyboard.layout
   ];
 })
diff --git a/third_party/default.nix b/third_party/default.nix
index 9fb26887e0..48a4a38285 100644
--- a/third_party/default.nix
+++ b/third_party/default.nix
@@ -36,6 +36,8 @@ let
       age
       autoconf
       autoreconfHook
+      avrlibc
+      avrdude
       awscli
       bashInteractive
       bat
@@ -58,6 +60,9 @@ let
       coreutils
       cudatoolkit
       darwin
+      dfu-programmer
+      dfu-util
+      diffutils
       dockerTools
       execline
       fetchFromGitHub
@@ -106,6 +111,7 @@ let
       pandoc
       parallel
       pkgconfig
+      pkgsCross
       postgresql
       pounce
       pulseaudio
@@ -128,6 +134,7 @@ let
       symlinkJoin
       systemd
       tdlib
+      teensy-loader-cli
       terraform_0_12
       texlive
       thttpd
diff --git a/users/glittershark/keyboard/default.nix b/users/glittershark/keyboard/default.nix
index 18169b5be1..7227c1d318 100644
--- a/users/glittershark/keyboard/default.nix
+++ b/users/glittershark/keyboard/default.nix
@@ -1,7 +1,8 @@
-{ nixpkgs ? import <nixpkgs> {}
-}:
+{ pkgs, ... }:
 
-with nixpkgs;
+with pkgs;
+
+let avrlibc = pkgsCross.avr.libcCross; in
 
 rec {
   qmkSource = fetchgit {
@@ -11,18 +12,29 @@ rec {
     fetchSubmodules = true;
   };
 
-  qmk = import "${qmkSource}/shell.nix" {
-    avr = true;
-    teensy = true;
-    arm = false;
-  };
-
-  layout = stdenv.mkDerivation {
+  layout = stdenv.mkDerivation rec {
     name = "ergodox_ez_grfn.hex";
 
     src = qmkSource;
 
-    inherit (qmk) buildInputs AVR_CFLAGS AVR_ASFLAGS;
+    buildInputs = [
+      dfu-programmer
+      dfu-util
+      diffutils
+      git
+      python3
+      pkgsCross.avr.buildPackages.binutils
+      pkgsCross.avr.buildPackages.gcc8
+      avrlibc
+      avrdude
+    ];
+
+    AVR_CFLAGS = [
+      "-isystem ${avrlibc}/avr/include"
+      "-L${avrlibc}/avr/lib/avr5"
+    ];
+
+    AVR_ASFLAGS = AVR_CFLAGS;
 
     patches = [ ./increase-tapping-delay.patch ];
 
diff --git a/users/glittershark/keyboard/flash b/users/glittershark/keyboard/flash
index 64f721f419..efc89463c8 100755
--- a/users/glittershark/keyboard/flash
+++ b/users/glittershark/keyboard/flash
@@ -1,2 +1,2 @@
 #!/usr/bin/env bash
-exec "$(nix-build --no-out-link . -A flash)"
+exec "$(nix-build --no-out-link ../../.. -A users.glittershark.keyboard.flash)"