Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nix install instructions use outdated/unsupported 1.52.1 compiler #81

Open
kpcyrd opened this issue Sep 26, 2022 · 2 comments
Open

Nix install instructions use outdated/unsupported 1.52.1 compiler #81

kpcyrd opened this issue Sep 26, 2022 · 2 comments
Labels
error There is an error in the book in some way

Comments

@kpcyrd
Copy link

kpcyrd commented Sep 26, 2022

Somebody in ##rust on irc had issues due to using a pre-2021 edition of rustc/cargo, turned out they were following the Recipe: Nix as development environment chapter of the godot-rust book which pins a specific version of nixpkgs:

let
    # Get an up-to-date package for enabling OpenGL support in Nix
    nixgl = import (fetchTarball "https://github.com/guibou/nixGL/archive/master.tar.gz") {};

    # Pin the version of the nix package repository that has Godot 3.2.3 and compatible with godot-rust 0.9.3
    # You might want to update the commit hash into the one that have your desired version of Godot
    # You could search for the commit hash of a particular package by using this website https://lazamar.co.uk/nix-versions
    pkgs = import (fetchTarball "https://github.com/nixos/nixpkgs/archive/5658fadedb748cb0bdbcb569a53bd6065a5704a9.tar.gz") {};
in
    # Configure the dependency of your shell
    # Add support for clang for bindgen in godot-rust
    pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
        buildInputs = [
            # Rust related dependencies
            pkgs.rustc
            pkgs.cargo
            pkgs.rustfmt
            pkgs.libclang

            # Godot Engine Editor
            pkgs.godot

            # The support for OpenGL in Nix
            nixgl.nixGLDefault
        ];

        # Point bindgen to where the clang library would be
        LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
        # Make clang aware of a few headers (stdbool.h, wchar.h)
        BINDGEN_EXTRA_CLANG_ARGS = with pkgs; ''
          -isystem ${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion clang}/include
          -isystem ${llvmPackages.libclang.out}/lib/clang/${lib.getVersion clang}/include
          -isystem ${glibc.dev}/include
        '';

        # For Rust language server and rust-analyzer
        RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";

        # Alias the godot engine to use nixGL
        shellHook = ''
            alias godot="nixGL godot -e"
        '';
    }

The gdnative-core crate of the godot-rust project depends on indexmap = "1.6.0", this resolves to indexmap 1.9.1 which uses 2021 edition.

@kpcyrd kpcyrd added the error There is an error in the book in some way label Sep 26, 2022
@Bromeon
Copy link
Member

Bromeon commented Sep 26, 2022

Hello! 🙂

Someone recently updated the Nix recipe (https://github.com/godot-rust/book/pull/80), but it seems like more is needed. It also looks like the recipe refers to Godot 3.2.3 and gdnative 0.9.3, both of which are quite outdated.

Do you know if there are more recent versions (for gdnative 0.10) available? indexmap should also resolve to any 1.x version. If yes, would you be willing to create a PR to update this?

@Bromeon Bromeon mentioned this issue Mar 2, 2023
@RobWalt
Copy link
Contributor

RobWalt commented Mar 2, 2023

Hey @kpcyrd, is this still an issue? I tried out the script today and it worked fine for me. Also note that you can always update the version of nixpkgs used as stated in the comments at the top above let pkgs = ....

If it's still an issue some more context would be helpful for resolving this, like

What is the exact error message and when does it occur?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error There is an error in the book in some way
Projects
None yet
Development

No branches or pull requests

3 participants