Go to file
Otavio Salvador 6a007cf4ef hosttools: skip the fixup phase
Avoid to apply the patchelf command to ELF executables and libraries to
remove unused directories from the RPATH.

Fixes:

% openocd
openocd: /nix/store/.../hosttools/.../lib/libc.so.6: version
`GLIBC_ABI_DT_RELR' not found (required by
/nix/store/.../...h9x-glibc-2.38-44/lib/libpthread.so.0)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2024-04-02 20:59:59 +13:00
.github/workflows Remove macos from testing matrix 2024-02-09 12:48:38 +13:00
README.md Fix devShells in the example flake.nix 2024-03-02 15:10:03 +13:00
default.nix hosttools: skip the fixup phase 2024-04-02 20:59:59 +13:00
flake.lock Bump flake inputs 2024-03-02 15:12:51 +13:00
flake.nix Use new Zephyr v3.6.0 release 2024-03-02 15:11:32 +13:00
python.nix python: Use clang-tools_17 as pypi follows the newest 2024-03-02 15:11:32 +13:00
sdk.json sdk: Upgrade to 0.16.5-1 due to aarch64 host support 2024-03-02 15:11:32 +13:00
update-sdk Initial 2024-02-06 16:48:31 +13:00

README.md

zephyr-nix

Develop Zephyr projects using Nix

Features

  • SDK packaging

    • sdk

    The minimal SDK. Can be overriden with additional targets.

    sdk.override {
      targets = [
        "arm-zephyr-eabi"
      ];
    }
    
    • sdkFull

    SDK with all targets enabled.

  • Host tools packaging

    • hosttools

    Binary hosttools from the Zephyr SDK. Because of libc incompatibilities not all binaries in this derivation actually works.

    • hosttools-nix

    A re-packaging of the Zephyr SDK hosttools using nixpkgs packages.

Basic usage

  • shell.nix
{ mkShell
, zephyr
, callPackage
, cmake
, ninja
, lib
}:

mkShell {
  packages = [
    (zephyr.sdk.override {
      targets = [
        "arm-zephyr-eabi"
      ];
    })
    zephyr.pythonEnv
    # Use zephyr.hosttools-nix to use nixpkgs built tooling instead of official Zephyr binaries
    zephyr.hosttools
    cmake
    ninja
  ];

}

Flakes usage

  • flake.nix
{
  description = "A very basic Zephyr flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    # Customize the version of Zephyr used by the flake here
    zephyr.url = "github:zephyrproject-rtos/zephyr/v3.5.0";
    zephyr.flake = false;

    zephyr-nix.url = "github:adisbladis/zephyr-nix";
    zephyr-nix.inputs.nixpkgs.follows = "nixpkgs";
    zephyr-nix.inputs.zephyr.follows = "zephyr";
  };

  outputs = { self, nixpkgs, zephyr-nix, ... }: let
    pkgs = nixpkgs.legacyPackages.x86_64-linux;
    zephyr = zephyr-nix.packages.x86_64-linux;
  in {
    devShells.x86_64-linux.default = pkgs.mkShell {
      # Use the same mkShell as documented above
    };
  };
}