forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
51 lines (43 loc) · 1.37 KB
/
flake.nix
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
40
41
42
43
44
45
46
47
48
49
50
51
{
description =
"Compiling and flashing QMK firmware to a Aurora (ferris) sweep";
inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; };
outputs = { self, nixpkgs }:
let
inherit (nixpkgs) lib;
withSystem = f:
lib.fold lib.recursiveUpdate { } (map f [ "x86_64-linux" ]);
in withSystem (system:
let
pkgs = import nixpkgs { inherit system; };
keyboard = "splitkb/aurora/sweep/rev1";
keymap = "mokasin";
in {
packages.${system}.default = pkgs.stdenv.mkDerivation {
name = "qmk-firmware";
src = ./.;
nativeBuildInputs = [ pkgs.qmk pkgs.python3 ];
NIX_BUILD_CORES = 8;
buildPhase = ''
patchShebangs .
SKIP_GIT=true SKIP_VERSION=true \
qmk compile -c -e CONVERT_TO=liatris -j $NIX_BUILD_CORES -kb ${keyboard} -km ${keymap}
'';
installPhase = ''
mkdir $out
cp -r .build/*.uf2 $out/
'';
};
devShells.${system}.default = pkgs.mkShell {
buildInputs = [ pkgs.qmk ];
shellHook = ''
build() {
BUILD_DIR=''${1:-.build}
SKIP_GIT=true SKIP_VERSION=true \
qmk compile -e CONVERT_TO=liatris -j 4 -kb ${keyboard} -km ${keymap}
}
'';
};
}
);
}