about summary refs log tree commit diff
path: root/users/flokli/keyboard/default.nix
blob: 708bec7313b657ab68eefcf9968e43f76728b26f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ depot, pkgs, ... }:

rec {
  firmware = pkgs.stdenv.mkDerivation {
    name = "keychron-k6_pro-firmware";

    src = pkgs.fetchFromGitHub {
      owner = "Keychron"; # the Keychron fork of qmk/qmk_firmware
      repo = "qmk_firmware";
      rev = "e0a48783e7cde92d1edfc53a8fff511c45e869d4"; # bluetooth_playground branch
      hash = "sha256-Pk9kXktmej9JyvSt7UMEW2FDrBg7k1lOssh6HjrP5ro=";
      fetchSubmodules = true;
    };

    nativeBuildInputs = [
      pkgs.qmk
    ];

    buildPhase = ''
      mkdir -p keyboards/keychron/k6_pro/ansi/rgb/keymaps/flokli
      cp ${./keymap.c} keyboards/keychron/k6_pro/ansi/rgb/keymaps/flokli/keymap.c
      cp ${./rules.mk} keyboards/keychron/k6_pro/ansi/rgb/keymaps/flokli/rules.mk

      make keychron/k6_pro/ansi/rgb:flokli
    '';

    installPhase = ''
      mkdir -p $out

      cp keychron_k6_pro_ansi_rgb_flokli.bin $out/
    '';
  };

  flash = pkgs.writeShellScript "flash.sh" ''
    ${pkgs.qmk}/bin/qmk flash ${firmware}/keychron_k6_pro_ansi_rgb_flokli.bin
  '';

  meta.ci.targets = [ "firmware" ];
}