Nim development

Hi, I can’t figure out how to start Nim development shell with nim and nimble available. The following flake gives me an error:

{
  inputs = {
    utils.url = "github:numtide/flake-utils";
  };
  outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
    let
      pkgs = nixpkgs.legacyPackages.${system};
    in
    {
      devShell = pkgs.mkShell {
        buildInputs = with pkgs; [
          nim
          nimPackages.nimble
        ];
      };
    }
  );
}
error: undefined variable 'nimPackages'

If you search for nimble on search.nixos.org, you’ll notice that it appears under the nimPackages. prefix on the 23.11 channel but by itself on unstable. So you’re probably using unstable, and should either pin to 23.11 or drop the nimPackages. prefix.

2 Likes

Thank you. It does fix it. I usually search on unstable but something went wrong.