zmk/flake.nix
adisbladis 2857e2495b Add Nix flake
This is another take on #1026 that aims to minimally implement a Nix development environment.

Notable differences are:

- Uses `pyproject.nix` for auto-packaging of the environment
  - Mach-nix is unmaintained
    Not only is it unmaintained but extremely heavy weight.

  - Uses nixpkgs Python packages
    Which means better binary cache performance than mach-nix offers.

- No direnv additions
I use direnv myself but expect users to be able to `echo 'use flake' > .envrc` if they want to use direnv.

- Uses zephyr sources from a flake input
This should make maintenance simpler as there is no manual updating required.
2024-02-20 20:43:41 +13:00

52 lines
1.2 KiB
Nix

{
description = "# Zephyr Mechanical Keyboard (ZMK) Firmware";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
# Customize the version of Zephyr used by the flake here
zephyr = {
type = "github";
owner = "zmkfirmware";
repo = "zephyr";
ref = "v3.5.0+zmk-fixes";
flake = false;
};
zephyr-nix.url = "github:adisbladis/zephyr-nix";
zephyr-nix.inputs.nixpkgs.follows = "nixpkgs";
zephyr-nix.inputs.zephyr.follows = "zephyr";
};
outputs =
{ nixpkgs
, flake-utils
, zephyr-nix
, ...
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
zephyr = zephyr-nix.packages.x86_64-linux;
in
{
devShell =
pkgs.mkShellNoCC {
packages = [
(zephyr.sdk.override {
targets = [
"arm-zephyr-eabi"
];
})
zephyr.pythonEnv
zephyr.hosttools-nix
pkgs.cmake
pkgs.ccache
pkgs.ninja
pkgs.dfu-util
];
};
});
}