Skip to content

Commit

Permalink
Package 0.16 SDK as separate attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Nov 4, 2024
1 parent fc058be commit 927e667
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 2 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ mkShell {
}
```

## Using specific SDK versions

`zephyr-nix` packages multiple Zephyr SDK versions that can be accessed by their versioned attributes.

- Classic Nix
```
{ pkgs, zephyr-nix }:
pkgs.mkShell {
packages = [
zephyr-nix.sdks."0.16".sdkFull
];
}
```

- Flakes

Flake output schema requires packages to be flat, so the nested SDKs sets are folded into the top-level:

```
devShells.x86_64-linux.default = pkgs.mkShell {
packages = [
zephyr-nix.packages.x86_64-linux.sdkFull-0_16
];
};
```

## Building a west project with Nix

For building [west](https://docs.zephyrproject.org/latest/develop/west/index.html) projects with Nix you can use [west2nix](https://github.com/adisbladis/west2nix).
9 changes: 7 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
, gcc_multi
, autoreconfHook
, fetchFromGitHub
, pkgs
, python310
, python38
}:

lib.makeScope newScope (self: let
Expand All @@ -16,7 +17,11 @@ lib.makeScope newScope (self: let

sdks = lib.fix (self: {
"0_17" = mkSdk "0_17" {
python3 = pkgs.python310;
python3 = python310;
};

"0_16" = mkSdk "0_16" {
python3 = python38;
};

latest = self."0_17";
Expand Down
38 changes: 38 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
pyproject-nix.url = "github:nix-community/pyproject.nix";
pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";

nixpkgs-python.url = "github:cachix/nixpkgs-python";
nixpkgs-python.inputs.nixpkgs.follows = "nixpkgs";

zephyr.url = "github:zephyrproject-rtos/zephyr/v3.7.0";
zephyr.flake = false;
};
Expand All @@ -17,6 +20,7 @@
nixpkgs,
zephyr,
pyproject-nix,
nixpkgs-python,
}:
(
let
Expand Down Expand Up @@ -46,6 +50,7 @@
packages' = pkgs.callPackage ./. {
zephyr-src = zephyr;
inherit pyproject-nix;
python38 = nixpkgs-python.packages.${system}."3.8";
};

sdks' = removeAttrs packages'.sdks [ "latest" ];
Expand Down
Loading

0 comments on commit 927e667

Please sign in to comment.