Added zmk-nix template

This commit is contained in:
Alejandro Angulo 2024-07-13 10:22:41 -07:00
parent 8e44335017
commit cd217cb4c7
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
8 changed files with 234 additions and 3 deletions

8
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
commit-message:
prefix: "ci"

26
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,26 @@
name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v11
- run: nix -vL --show-trace flake check
- run: nix -vL --show-trace build
- uses: actions/upload-artifact@v4
with:
name: zmk_firmware
path: result

44
.github/workflows/deps.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: Dependencies
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
permissions:
pull-requests: write
contents: write
jobs:
update:
name: Update
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v12
- run: nix -vL run --show-trace .#update
- id: create-pr
uses: peter-evans/create-pull-request@v6
with:
branch: update_zmk_config_deps
delete-branch: true
committer: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'
author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'
commit-message: 'config,nix: update deps'
title: 'config,nix: update deps'
labels: 'dependencies'
body: |
Automated bump of ZMK dependencies
- uses: benc-uk/workflow-dispatch@v1
if: ${{ contains(fromJSON('["created", "updated"]'), steps.create-pr.outputs.pull-request-operation) }}
with:
workflow: ci.yml
ref: refs/heads/update_zmk_config_deps

32
.github/workflows/flake.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Flake
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
update:
name: Update
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v11
- id: update-flake-lock
uses: DeterminateSystems/update-flake-lock@v21
with:
commit-msg: 'flake: update inputs'
pr-title: 'flake: update inputs'
pr-labels: 'dependencies'
- uses: benc-uk/workflow-dispatch@v1
if: ${{ contains(fromJSON('["created", "updated"]'), steps.update-flake-lock.outputs.pull-request-operation) }}
with:
workflow: ci.yml
ref: refs/heads/update_flake_lock_action

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
/.west
/modules
/zephyr
/zmk
/build
/result

View file

@ -2,12 +2,33 @@ manifest:
remotes: remotes:
- name: zmkfirmware - name: zmkfirmware
url-base: https://github.com/zmkfirmware url-base: https://github.com/zmkfirmware
# Additional modules containing boards/shields/custom code can be listed here as well
# See https://docs.zephyrproject.org/3.2.0/develop/west/manifest.html#projects
projects: projects:
- name: zephyr
remote: zmkfirmware
revision: 87fa801c5b91f13599358c003bdcafaa54e3543c # v3.5.0+zmk-fixes
import:
name-blocklist:
- ci-tools
- hal_altera
- hal_cypress
- hal_infineon
- hal_microchip
- hal_nxp
- hal_openisa
- hal_silabs
- hal_xtensa
- hal_st
- hal_ti
- loramac-node
- mcuboot
- mcumgr
- net-tools
- openthread
- edtt
- trusted-firmware-m
- name: zmk - name: zmk
remote: zmkfirmware remote: zmkfirmware
revision: main revision: 8c6bda260ace119b3c22a21bdcdd6d17a83fc5eb # main
import: app/west.yml import: app/west.yml
self: self:
path: config path: config

48
flake.lock Normal file
View file

@ -0,0 +1,48 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1720781449,
"narHash": "sha256-po3TZO9kcZwzvkyMJKb0WCzzDtiHWD34XeRaX1lWXp0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8b5a3d5a1d951344d683b442c0739010b80039db",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"zmk-nix": "zmk-nix"
}
},
"zmk-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1720312285,
"narHash": "sha256-oa3UxPaqFSdPlcB4CxQK9L4NTDV/pcubItrIda5yadM=",
"owner": "lilyinstarlight",
"repo": "zmk-nix",
"rev": "b801185a6e260faffc6459d2009626262abc779f",
"type": "github"
},
"original": {
"owner": "lilyinstarlight",
"repo": "zmk-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

46
flake.nix Normal file
View file

@ -0,0 +1,46 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
zmk-nix = {
url = "github:lilyinstarlight/zmk-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
zmk-nix,
}: let
forAllSystems = nixpkgs.lib.genAttrs (nixpkgs.lib.attrNames zmk-nix.packages);
in {
packages = forAllSystems (system: rec {
default = firmware;
firmware = zmk-nix.legacyPackages.${system}.buildSplitKeyboard {
name = "firmware";
src = nixpkgs.lib.sourceFilesBySuffices self [".conf" ".keymap" ".dtsi" ".yml"];
board = "nice_nano_v2";
shield = "corne_%PART% nice_view_adapter nice_view";
zephyrDepsHash = "sha256-P3QtiGgVWRzpMg8fYfkdcKTnUqqjEhoQx36aVSJpT4M=";
meta = {
description = "ZMK firmware";
license = nixpkgs.lib.licenses.mit;
platforms = nixpkgs.lib.platforms.all;
};
};
flash = zmk-nix.packages.${system}.flash.override {inherit firmware;};
update = zmk-nix.packages.${system}.update;
});
devShells = forAllSystems (system: {
default = zmk-nix.devShells.${system}.default;
});
};
}