-
Notifications
You must be signed in to change notification settings - Fork 91
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
Cargo.toml
can't be found when setting both src
and root
#258
Comments
Hmm, reading files should work as-is (i.e. if it works during Would you mind posting some code that I could check? |
@Patryk27 I have the same issue. Code to reproduce the issue lies here: https://github.com/Luis-Hebendanz/perf_kernel/blob/2d7fc0156fe8346d92d763c908f4f15aeb92d1d1/flake.nix#L106 Error:
|
Ah, I see - yes, In general, adding a buildPackage {
src = ./.;
root = ./package;
preBuild = "cd package";
} ... so e.g. in your, @luis-hebendanz, case: diff --git a/flake.nix b/flake.nix
index 3fe10ba..5f92095 100644
--- a/flake.nix
+++ b/flake.nix
@@ -45,7 +45,10 @@
outputs = { self, nixpkgs, naersk, nci, rust-overlay, glue-gun, nix-ipxe, nix-parse-gdt, vmsh-flake, flake-utils, nixos-codium, ... }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
- naersk-lib = pkgs.callPackage naersk { };
+ naersk-lib = pkgs.callPackage naersk {
+ cargo = myrust;
+ rustc = myrust;
+ };
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
@@ -105,8 +108,10 @@
rec {
packages.default = naersk-lib.buildPackage {
src = ./.;
- buildInputs = buildDeps;
root = ./kernel;
+ preBuild = "cd kernel";
+ buildInputs = buildDeps;
+
#remapPathPrefix = false;
singleStep = true;
}; (note that the compilation will still fail, but at least with a different error message - |
@Patryk27 Oh awesome, thank you! :-) |
@Patryk27 I just ran into this again for different reasons and tried your suggestion: buildPackage {
src = ./.;
root = ./backend;
preBuild = "cd backend";
} This didn't work for me because when Trying to use |
@paulyoung: would you mind preparing some repository I could |
with "cd ." it starts compiling but then fails post installation with the "cant find toml" error |
I've had
root = ./backend;
for a while but now I'm trying to get Rust to read a.env
file at the root of my project (which appears to work outside of using naersk) so I also setsrc = ./.;
When doing this I get the following:
My understanding is that
root
should be used to readCargo.toml
.The text was updated successfully, but these errors were encountered: