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

How to use nightly channel #378

Open
PuffyWithEyes opened this issue Jan 3, 2025 · 2 comments
Open

How to use nightly channel #378

PuffyWithEyes opened this issue Jan 3, 2025 · 2 comments

Comments

@PuffyWithEyes
Copy link

I have default.nix which compiles the application. I have my own crate that uses several functions from nightly. My default.nix:

{ pkgs ? import ./nix/nixpkgs.nix { config = { allowUnfree = true; }; }
, lib ? pkgs.lib
, stdenv ? pkgs.stdenv
, generatedCargoNix ? import ./Cargo.nix
}:
let
  llvmclang = pkgs.llvmPackages_latest.libclang;

  generatedBuild = pkgs.callPackage generatedCargoNix {
    defaultCrateOverrides = pkgs.defaultCrateOverrides // {
      v4l2-sys-mit = attrs: {
        buildINputs = with pkgs; [
          clang
          glibc.dev
          llvmclang
          linuxHeaders
          libv4l.dev
        ];
        LIBCLANG_PATH = "${llvmclang.lib}/lib";
        BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.linuxHeaders}/include -I${pkgs.glibc.dev}/include";
      };
      my-crate = attrs: {
        buildInputs = with pkgs; [
          clang
          cudaPackages.cuda_cudart
          cudaPackages.cuda_nvcc
          cudaPackages.libcufft
        ];
        CFLAGS = "-I${pkgs.cudaPackages.cuda_cudart}/include";
        CXXFLAGS = "-I${pkgs.cudaPackages.cuda_cudart}/include";
        CUDA_HOST_COMPILER = "${pkgs.clang}/bin/clang";
        CXX = "clang";
      };
    };
  };
in
generatedBuild.rootCrate.build

But i got an error
image

@apoelstra
Copy link
Contributor

You should be able to generate Cargo.nix with the normal nixpkgs rustc. Then when calling it, you override buildRustCrateForPkgs. I have an example here: https://github.com/apoelstra/local-nix-ci/blob/main/andrew-utils.nix#L527-L573 though this also does several other things which might not be interesting to you.

@PuffyWithEyes
Copy link
Author

PuffyWithEyes commented Jan 6, 2025

@apoelstra I'm very sorry, but I couldn't implement your example in my code. Could you send another example or explain this one in more detail, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants