Open FerrisWasTaken opened 2 years ago
rust-toolchain.toml
shall be for rustup
not cargo
, for getting a rust toolchain corresponding to your toolchain file, https://github.com/oxalica/rust-overlay can be your best companion.
What does
./configuration.nix # Your system configuration.
mean?
That part is for installing the specified toolchain in your NixOS system globally.
Any way I can use
[ (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) ]
local only?
Yes
how
also
{ pkgs ? import <nixpkgs> { overlays = [ (import <rust-overlay>) ]; }
}:
pkgs.stdenv.mkDerivation rec {
pname = "ros";
version = "0.1.0";
buildInputs = [
pkgs.rustc
pkgs.cargo
pkgs.cargo-bootimage
];
src = ./.;
outputs = { nixpkgs, rust-overlay, ... }: {
nixosConfigurations = {
hostname = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }: {
nixpkgs.overlays = [ rust-overlay.overlay ];
environment.systemPackages = [ pkgs.rust-bin.nightly.latest.default ];
})
];
};
};
};
PATH = "$PATH:~/.cargo/bin";
CARGO_MANIFEST_DIR = ./.;
outputHash = "23ebe1a4b801802ab62c8a024cfb6cff89b9e06dab15fc094b05547fc67755db";
outputHashAlgo = "sha256";
outputHashMode = "flat";
configurePhase = ''
'';
buildPhase = ''
cargo bootimage --release
'';
installPhase = ''
mkdir -p $out/bin
mv /target/x86_64-ros/release/bootimage-ros.bin $out/bin
'';
}
Is this the correct way to integrate it/
more like
{
pkgs ? import <nixpkgs> { overlays = [ rust-overlay ]; },
rust-overlay ? import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")
}:
let
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
pkgs.stdenv.mkDerivation rec {
pname = "ros";
version = "0.1.0";
nativeBuildInputs = [
toolchain
pkgs.cargo-bootimage
];
src = ./.;
PATH = "$PATH:~/.cargo/bin";
CARGO_MANIFEST_DIR = ./.;
outputHash = "23ebe1a4b801802ab62c8a024cfb6cff89b9e06dab15fc094b05547fc67755db";
outputHashAlgo = "sha256";
outputHashMode = "flat";
configurePhase = ''
'';
buildPhase = ''
cargo bootimage --release
'';
installPhase = ''
mkdir -p $out/bin
mv /target/x86_64-ros/release/bootimage-ros.bin $out/bin
'';
}
But your target is a bit exotic, I doubt whether there's prebuilt toolchain for that.
Its a custom toolchain.
This sounds, a bit challenging, what about resorting to rustup for now?
So how do I do that?
Just do whatever you would do on other distributions? Guess there's a bunch of nice tutorials out there.
Also I checked that there was support for custom rust targets in nixpkgs, but broken now for some reason. I would investigate into that later.
Steps To Reproduce
Steps to reproduce the behavior:
https://github.com/muppi090909/ROS
nix-build default.nix
Build log
Additional context
My rust-toolchain.toml
x86_64-ros.json
The problem is that cargo is not identifying rust-toolchain.toml.
Notify maintainers
@retrry
Metadata
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked): /nix/store/ym48rw2727g45akp4bd6bgng9wwil5y5-nix-info copying path '/nix/store/ym48rw2727g45akp4bd6bgng9wwil5y5-nix-info' from 'https://cache.nixos.org'...
"x86_64-linux"
Linux 5.15.0-39-generic, Ubuntu, 22.04 LTS (Jammy Jellyfish), nobuild
no
yes
nix-env (Nix) 2.9.1
"nixpkgs"
/home/perseus/.nix-defexpr/channels/nixpkgs