-
Hi, are you aware whether cargo-auditable should work with cargo-chef or crate2nix? All of these tools somehow wrap cargo but I'm not too sure how much they play around with the internals. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
Crate2nix probably isn't going to work as cargo-auditable expects the inner cargo invocation to directly compile the program and passes a couple of env vars to it's rustc wrapper. I expect crate2nix to miss these env vars and possibly even the rustc wrapper. As for cargo-chef, if you can tell cargo-chef to invoke |
Beta Was this translation helpful? Give feedback.
-
@figsoda might be answer the bit about crate2nix, since he's been working on enabling |
Beta Was this translation helpful? Give feedback.
-
I am not very familiar with I tried to build crate2nix with cargo-auditable with no success, here is the WIP patch (doesn't work) that tries to emulate what cargo_auditable.rs does --- a/default.nix
+++ b/default.nix
@@ -12,7 +12,19 @@
, release ? true
}:
let
- cargoNix = callPackage ./crate2nix/Cargo.nix { inherit release; };
+ cargoNix = callPackage ./crate2nix/Cargo.nix {
+ inherit release;
+ buildRustCrateForPkgs = pkgs: pkgs.buildRustCrate.override {
+ cargo = pkgs.cargo-auditable-cargo-wrapper;
+ rustc = pkgs.writeShellScriptBin "rustc" ''
+ export CARGO=${pkgs.cargo}/bin/cargo
+ export CARGO_AUDITABLE_ORIG_ARGS=[]
+ export PATH=${pkgs.rustc}/bin:$PATH
+ export RUSTC_WORKSPACE_WRAPPER=${pkgs.cargo-auditable}/bin/cargo-auditable
+ ${pkgs.cargo-auditable}/bin/cargo-auditable rustc "$@"
+ '';
+ };
+ };
withoutTemplates = name: type:
let
baseName = builtins.baseNameOf (builtins.toString name);
--- a/nix/sources.json
+++ b/nix/sources.json
@@ -53,10 +53,10 @@
"homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "5f588eb4a958f1a526ed8da02d6ea1bea0047b9f",
- "sha256": "1wgk7d1j8yj3arsbiva69bicnf3m9id8knjp625knq0siv3i9xsg",
+ "rev": "5a350a8f31bb7ef0c6e79aea3795a890cf7743d4",
+ "sha256": "0fjii4ay8lp1byq74vq6p5bv754ssbf0ij5xwr5zr27db23ws77j",
"type": "tarball",
- "url": "https://github.com/NixOS/nixpkgs/archive/5f588eb4a958f1a526ed8da02d6ea1bea0047b9f.tar.gz",
+ "url": "https://github.com/NixOS/nixpkgs/archive/5a350a8f31bb7ef0c6e79aea3795a890cf7743d4.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs-mozilla": { |
Beta Was this translation helpful? Give feedback.
-
Wow! Thank you so much everyone for the detailed (and fast) responses 🙇 |
Beta Was this translation helpful? Give feedback.
We decided that (for now) we'll use two builds: For release we're not going to use crate2nix/cargo-chef but normal cargo + auditable and for local dev we're going to use one of those solutions.
Thanks again!