-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
93 lines (86 loc) · 2.43 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
glove80-zmk = {
url = "github:juliamertz/zmk";
flake = false;
};
zmk-helpers = {
url = "github:urob/zmk-helpers";
flake = false;
};
dtsfmt = {
url = "github:juliamertz/dtsfmt";
inputs.nixpkgs.follows = "nixpkgs";
};
firmware-loader = {
url = "github:juliamertz/glove80-firmware-updater";
inputs.nixpkgs.follows = "nixpkgs";
};
keymap-drawer = {
url = "github:caksoylar/keymap-drawer";
flake = false;
};
};
outputs =
{
nixpkgs,
flake-parts,
firmware-loader,
...
}@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
perSystem =
{
config,
pkgs,
lib,
system,
...
}:
let
inherit (pkgs) callPackage writeShellScriptBin writeText;
inherit (config) packages;
firmwareLoader = firmware-loader.packages.${system}.default;
dtsfmt = inputs.dtsfmt.packages.${system}.default;
in
{
packages = {
firmware = callPackage ./packages/firmware.nix { inherit inputs; };
visual = callPackage ./packages/visual.nix { inherit inputs; };
flash = writeShellScriptBin "flash" ''
${lib.getExe firmwareLoader} --file ${packages.firmware}/glove80.uf2 --mount
'';
format =
let
dtsfmtrc =
writeText ".dtsfmtrc.toml" # toml
''
layout = "moergo:glove80"
[options]
separate_sections = true
indent_size = 4
'';
in
writeShellScriptBin "dtsfmt" ''
${lib.getExe dtsfmt} --config-file ${dtsfmtrc} $@
'';
};
devShells.default = pkgs.mkShell { packages = [ packages.format ]; };
packages.default = packages.firmware;
apps.default = {
type = "app";
program = packages.flash;
};
};
};
}