This commit is contained in:
Brian Romanko 2023-12-26 17:50:55 +13:00 committed by GitHub
commit 1a19d91cf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 1 deletions

1
.envrc-nix Normal file
View file

@ -0,0 +1 @@
use nix

4
.gitignore vendored
View file

@ -6,4 +6,6 @@
/zmk-config
/build
*.DS_Store
__pycache__
__pycache__
/.direnv
.envrc

43
flake.lock generated Normal file
View file

@ -0,0 +1,43 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1638910453,
"narHash": "sha256-fofA4tsAAdNgE+9Py0VsVbyX2ZQkgV+CVqQKGBA/dLE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f225322e3bea8638304adfcf415cd11de99f2208",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

11
flake.nix Normal file
View file

@ -0,0 +1,11 @@
{
description = "# Zephyr Mechanical Keyboard (ZMK) Firmware";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in { devShell = import ./shell.nix { inherit pkgs; }; });
}

34
shell.nix Normal file
View file

@ -0,0 +1,34 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
let inherit (lib) ;
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix";
ref = "master";
}) {
python = "python3";
};
zephyr-requirements = fetchurl {
url = "https://raw.githubusercontent.com/zephyrproject-rtos/zephyr/v2.5.0/scripts/requirements-base.txt";
sha256 = "919a78ba9457a8e55451450329158ff7fdcbc4a2ddb0dd76ea804c3b04a3c6c6";
};
python-pkgs = mach-nix.mkPython rec {
requirements = builtins.readFile zephyr-requirements;
};
in mkShell {
buildInputs = [
cmake
ccache
ninja
dtc
dfu-util
gcc-arm-embedded
python-pkgs
];
shellHook = ''
export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
export GNUARMEMB_TOOLCHAIN_PATH=${pkgs.gcc-arm-embedded}
'';
}