Bend and the rust overlay

Hello! Does anybody know how I can provide the bend-lang package to a devshell, and have it installed and ready to go? I can just install it once I’m in the devshell, but I’d rather have nix provide it. Is it possibly toolchain.minimal that’s causing problems?

Here’s my flake.nix:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    rust-overlay.url = "github:oxalica/rust-overlay";
  };
  outputs = { self, nixpkgs, flake-utils, rust-overlay }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let
          overlays = [ (import rust-overlay) ];
          pkgs = import nixpkgs {
            inherit system overlays;
          };
        in
        with pkgs;
        {
          devShells.default = mkShell {
            buildInputs = with pkgs; [
              (rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal).override {
                extensions = [ "rust-src" ];
                targets = [ "thumbv6m-none-eabi" ];
              })
            ] ++  [
              openocd
              rust-analyzer
              rustfmt
              flip-link
              probe-rs
              kicad
              bend
            ];
          };
        }
      );
}

Ah! I just messed up the rust-bin dependency by not surrounding it with parentheses, so that operator precedence doesn’t mess stuff up. For later reference, the working flake looks like this:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    rust-overlay.url = "github:oxalica/rust-overlay";
  };
  outputs = { self, nixpkgs, flake-utils, rust-overlay }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let
          overlays = [ (import rust-overlay) ];
          pkgs = import nixpkgs {
            inherit system overlays;
          };
        in
        # with pkgs;
        {
          devShells.default = with pkgs; mkShell {
            buildInputs = [
              (rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal.override {
                extensions = [ "rust-src" ];
                targets = [ "thumbv6m-none-eabi" ];
              }))
           ] ++  [
              openocd
              rust-analyzer
              rustfmt
              flip-link
              probe-rs
              kicad
              bend
            ];
          };
        }
      );
}
1 Like