-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
58 lines (56 loc) · 1.67 KB
/
Copy pathflake.nix
File metadata and controls
58 lines (56 loc) · 1.67 KB
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
52
53
54
55
56
57
58
{
description = "Nix flake to compile out-of-tree QMK firmwares";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
qmk_firmware = {
url = "https://github.com/qmk/qmk_firmware";
ref = "54e8fad959d6a6e53e08c62ac3a3c4d4bdc6c957";
flake = false;
type = "git";
submodules = true;
};
};
outputs =
{
nixpkgs,
flake-utils,
qmk_firmware,
...
}:
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
mkQmkFirmware = pkgs.callPackage (import ./nix/build.nix qmk_firmware) { };
mkFlashQmkFirmware = pkgs.callPackage (import ./nix/flash.nix qmk_firmware) { };
mkCompileDb = pkgs.callPackage (import ./nix/compiledb.nix qmk_firmware) { };
flashQmkFirmware =
args:
let
firmware = mkQmkFirmware args;
in
{
type = "app";
program = "${mkFlashQmkFirmware (removeAttrs args [ "src" ] // { inherit firmware; })}/bin/flash";
};
in
{
formatter = pkgs.nixfmt-rfc-style;
lib = { inherit mkQmkFirmware flashQmkFirmware mkCompileDb; };
}
))
// {
templates = rec {
default = ergodox_ez;
ergodox_ez = {
path = ./templates/ergodox_ez;
description = "A simple flake to build a firmware for the Ergodox EZ keyboard";
};
multiple_keyboards = {
path = ./templates/multiple_keyboards;
description = "A flake demonstrating how to build firmwares for multiple keyboards";
};
};
};
}