feat(users/flokli/kb): add chocofi
`buildSplitKeyboard`, as well as all the patching of `miryoku_zmk` is independent of the specific keyboard used, so it can be moved one layer up. `config-flat` is now provided through a helper function, accepting the name of the keymap to use when rendering the config. This all makes the amount of code added for the new keyboard itself pleasantly small. Change-Id: I2216aa246502eddaf9bc4f4d126b0639d574ad87 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12787 Reviewed-by: flokli <flokli@flokli.de> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
parent
7a54360a39
commit
c445970869
6 changed files with 88 additions and 48 deletions
25
users/flokli/keyboards/chocofi/default.nix
Normal file
25
users/flokli/keyboards/chocofi/default.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{ pkgs, depot, ... }:
|
||||||
|
rec {
|
||||||
|
firmware = depot.users.flokli.keyboards.buildSplitKeyboard {
|
||||||
|
name = "nice_nano_v2";
|
||||||
|
board = "nice_nano_v2";
|
||||||
|
shield = "corne_%PART% nice_view_adapter nice_view";
|
||||||
|
zephyrDepsHash = "sha256-D5CAlrO/E6DPbtUJyh/ec8ACpo1XM1jx2gLS2TpklBQ=";
|
||||||
|
src = depot.users.flokli.keyboards.miryoku_config;
|
||||||
|
};
|
||||||
|
|
||||||
|
config-flat = depot.users.flokli.keyboards.mkFlatConfig "corne";
|
||||||
|
|
||||||
|
flash-left = pkgs.writeShellScript "flash.sh" ''
|
||||||
|
cp ${firmware}/zmk_left.uf2 /run/media/$USER/NICENANO/
|
||||||
|
'';
|
||||||
|
|
||||||
|
flash-right = pkgs.writeShellScript "flash.sh" ''
|
||||||
|
cp ${firmware}/zmk_right.uf2 /run/media/$USER/NICENANO/
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta.ci.targets = [
|
||||||
|
"config-flat"
|
||||||
|
"firmware"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,57 +1,14 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, depot, ... }:
|
||||||
let
|
|
||||||
zmk-nix = pkgs.fetchFromGitHub {
|
|
||||||
owner = "lilyinstarlight";
|
|
||||||
repo = "zmk-nix";
|
|
||||||
rev = "d72e94ab94b2bceb60a29a2a8c2e1d304a4e922e";
|
|
||||||
hash = "sha256-3WXPPBJ2u8rMxejPhUahSiqOBr1BOfTgDa7oQDPtw54=";
|
|
||||||
};
|
|
||||||
|
|
||||||
builders = pkgs.callPackage (import (zmk-nix + "/nix/builders.nix")) { };
|
|
||||||
|
|
||||||
miryoku_zmk = pkgs.fetchFromGitHub {
|
|
||||||
owner = "manna-harbour";
|
|
||||||
repo = "miryoku_zmk";
|
|
||||||
rev = "e6683e9f8b6c199b339208b1b501e88a7308ed48";
|
|
||||||
hash = "sha256-GjTbAoyhr557Tn4JaWsA3Po5KxMsQXrpKc9H+PU3T8A=";
|
|
||||||
};
|
|
||||||
|
|
||||||
miryoku_zmk_patched = pkgs.runCommand "miryoku_zmk_patched" { } ''
|
|
||||||
mkdir -p $out
|
|
||||||
cp -r ${miryoku_zmk}/. $out/
|
|
||||||
cd $out
|
|
||||||
chmod -R +w $out
|
|
||||||
patch -p1 < ${./0001-miryoku_layer_alternatives.h-expose-alt-gr-on-G-and-.patch}
|
|
||||||
patch -p1 < ${./0001-miryoku_behaviors-add-quick-tap-ms-require-prior-idl.patch}
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
config = pkgs.runCommand "config" { } ''
|
firmware = depot.users.flokli.keyboards.buildSplitKeyboard {
|
||||||
mkdir -p $out/config
|
|
||||||
cp -r ${miryoku_zmk_patched}/miryoku $out/
|
|
||||||
cp ${./west.yml} $out/config/west.yml
|
|
||||||
cp ${miryoku_zmk_patched}/config/corneish_zen.keymap $out/config/
|
|
||||||
'';
|
|
||||||
|
|
||||||
# helpful for debugging the resulting keymap
|
|
||||||
config-flat = pkgs.runCommand "config-flat"
|
|
||||||
{
|
|
||||||
nativeBuildInputs = [ pkgs.python3.pkgs.pcpp ];
|
|
||||||
} ''
|
|
||||||
mkdir -p $out/config
|
|
||||||
cp ${./west.yml} $out/config/west.yml
|
|
||||||
pcpp --passthru-unfound-includes -o $out/config/corneish_zen.keymap ${miryoku_zmk_patched}/config/corneish_zen.keymap
|
|
||||||
'';
|
|
||||||
|
|
||||||
firmware = builders.buildSplitKeyboard {
|
|
||||||
name = "corneish_zen_v1";
|
name = "corneish_zen_v1";
|
||||||
board = "corneish_zen_v1_%PART%";
|
board = "corneish_zen_v1_%PART%";
|
||||||
zephyrDepsHash = "sha256-D5CAlrO/E6DPbtUJyh/ec8ACpo1XM1jx2gLS2TpklBQ=";
|
zephyrDepsHash = "sha256-D5CAlrO/E6DPbtUJyh/ec8ACpo1XM1jx2gLS2TpklBQ=";
|
||||||
src = config;
|
src = depot.users.flokli.keyboards.miryoku_config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config-flat = depot.users.flokli.keyboards.mkFlatConfig "corneish_zen";
|
||||||
|
|
||||||
flash-left = pkgs.writeShellScript "flash.sh" ''
|
flash-left = pkgs.writeShellScript "flash.sh" ''
|
||||||
cp ${firmware}/zmk_left.uf2 /run/media/$USER/CORNEISHZEN/
|
cp ${firmware}/zmk_left.uf2 /run/media/$USER/CORNEISHZEN/
|
||||||
'';
|
'';
|
||||||
|
|
@ -59,4 +16,9 @@ rec {
|
||||||
flash-right = pkgs.writeShellScript "flash.sh" ''
|
flash-right = pkgs.writeShellScript "flash.sh" ''
|
||||||
cp ${firmware}/zmk_right.uf2 /run/media/$USER/CORNEISHZEN/
|
cp ${firmware}/zmk_right.uf2 /run/media/$USER/CORNEISHZEN/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
meta.ci.targets = [
|
||||||
|
"config-flat"
|
||||||
|
"firmware"
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
53
users/flokli/keyboards/default.nix
Normal file
53
users/flokli/keyboards/default.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
|
||||||
|
let
|
||||||
|
zmk-nix = pkgs.fetchFromGitHub {
|
||||||
|
owner = "lilyinstarlight";
|
||||||
|
repo = "zmk-nix";
|
||||||
|
rev = "d72e94ab94b2bceb60a29a2a8c2e1d304a4e922e";
|
||||||
|
hash = "sha256-3WXPPBJ2u8rMxejPhUahSiqOBr1BOfTgDa7oQDPtw54=";
|
||||||
|
};
|
||||||
|
|
||||||
|
zmk_builders = pkgs.callPackage (import (zmk-nix + "/nix/builders.nix")) { };
|
||||||
|
|
||||||
|
miryoku_zmk = pkgs.fetchFromGitHub {
|
||||||
|
owner = "manna-harbour";
|
||||||
|
repo = "miryoku_zmk";
|
||||||
|
rev = "e6683e9f8b6c199b339208b1b501e88a7308ed48";
|
||||||
|
hash = "sha256-GjTbAoyhr557Tn4JaWsA3Po5KxMsQXrpKc9H+PU3T8A=";
|
||||||
|
};
|
||||||
|
|
||||||
|
miryoku_zmk_patched = pkgs.runCommand "miryoku_zmk_patched" { } ''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r ${miryoku_zmk}/. $out/
|
||||||
|
cd $out
|
||||||
|
chmod -R +w $out
|
||||||
|
patch -p1 < ${./0001-miryoku_layer_alternatives.h-expose-alt-gr-on-G-and-.patch}
|
||||||
|
patch -p1 < ${./0001-miryoku_behaviors-add-quick-tap-ms-require-prior-idl.patch}
|
||||||
|
'';
|
||||||
|
|
||||||
|
miryoku_config = pkgs.runCommand "config" { } ''
|
||||||
|
mkdir -p $out/config
|
||||||
|
cp -r ${miryoku_zmk_patched}/miryoku $out/
|
||||||
|
cp ${./west.yml} $out/config/west.yml
|
||||||
|
cp ${miryoku_zmk_patched}/config/*.keymap $out/config/
|
||||||
|
'';
|
||||||
|
|
||||||
|
# helpful for debugging a resulting keymap config
|
||||||
|
mkFlatConfig = name: pkgs.runCommand "config-flat"
|
||||||
|
{
|
||||||
|
nativeBuildInputs = [ pkgs.python3.pkgs.pcpp ];
|
||||||
|
} ''
|
||||||
|
mkdir -p $out/config
|
||||||
|
cp ${./west.yml} $out/config/west.yml
|
||||||
|
pcpp --passthru-unfound-includes -o $out/config/${name}.keymap ${miryoku_zmk_patched}/config/${name}.keymap
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
miryoku_zmk = miryoku_zmk_patched;
|
||||||
|
inherit (zmk_builders) buildSplitKeyboard;
|
||||||
|
inherit miryoku_config mkFlatConfig;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue