aboutsummaryrefslogtreecommitdiff
path: root/devShells/nuttx.nix
blob: 97675e9decf8920e0f808609222d7d96a407adbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
pkgs: c: {
  arch,
  fpu ? null,
}:
with builtins;
with pkgs.lib; let
  pkgsCross = import pkgs.path {
    localSystem = pkgs.buildPlatform.system;
    crossSystem = {
      config =
        if (hasPrefix "armv" arch)
        then "arm-none-eabi" + (optionalString (fpu != null) "hf")
        else "riscv32-none-elf";
      libc = "newlib";
      gcc =
        {
          inherit arch;
        }
        // (optionalAttrs (fpu != null) {inherit fpu;});
    };
  };
in
  pkgsCross.buildPackages.mkShell {
    packages = with pkgsCross.buildPackages;
      [
        kconfig-frontends
        genromfs
        xxd
        openocd
        gcc
        gdb
      ]
      ++ (optionals (hasPrefix "rv32" arch) [
        esptool
      ]);
    inputsFrom = [c];
    meta.platforms = pkgsCross.lib.platforms.linux;
  }