-
Notifications
You must be signed in to change notification settings - Fork 94
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
Incorrect generation #385
Comments
I also got stuck trying to override everything that is wrong with the generation (it's much more than just {inputs, ...}: {
perSystem = {inputs', lib, pkgs, system, ...}: let
toolchain = with inputs'.fenix.packages; combine [minimal.rustc minimal.cargo targets.wasm32-wasip1.latest.rust-std];
in {
packages.crate2nix = inputs'.crate2nix.packages.default.override {cargo = toolchain;};
packages.toolchain = toolchain;
packages.harpoon = let
# NOTE non-standard flake outputs (i.e. tools) are not cached on inputs'
cargoNix = inputs.crate2nix.tools.${system}.generatedCargoNix {
name = "harpoon";
src = pkgs.fetchFromGitHub {
owner = "Nacho114";
repo = "harpoon";
rev = "d3284615ba5063c73e0c1729edf5b10b46aead5e";
hash = "sha256-heQ81oZjREU2jMmVG02KJQ6DwnCa7zT1umb5kNENxWY=";
};
};
buildRustCrateForPkgs = pkgs: pkgs.buildRustCrate.override {
rustc = toolchain;
cargo = toolchain;
};
workspace = pkgs.callPackage cargoNix {inherit buildRustCrateForPkgs;};
buildRustCrates = workspace.internal.builtRustCratesWithFeatures {
packageId = "harpoon";
features = ["default"];
buildRustCrateForPkgsFunc = buildRustCrateForPkgs;
runTests = false;
crateConfigs = let
libc = {
name = "libc";
packageId = "libc";
target = { target, features }: (target."unix" or false);
};
in lib.recursiveUpdate workspace.internal.crates {
atty.dependencies = [(libc // {usesDefaultFeatures = false;})];
dirs-sys.dependencies = workspace.internal.crates.dirs-sys.dependencies ++ [libc];
dirs-sys-next.dependencies = [libc];
getrandom.dependencies = workspace.internal.crates.getrandom.dependencies ++ [libc];
# NOTE overridden with use-libc feature since default linux_raw backend doesn't work...
is-terminal.dependencies = [
{
name = "rustix";
packageId = "rustix 0.38.2";
target = { target, features }: (!((target."windows" or false) || ("hermit" == target."os" or null) || ("unknown" == target."os" or null)));
features = [ "termios" "use-libc" ];
}
];
chrono.dependencies = workspace.internal.crates.chrono.dependencies ++ [
{
name = "iana-time-zone";
packageId = "iana-time-zone";
}
];
iana-time-zone = {
crateName = "iana-time-zone";
version = "0.1.61";
edition = "2018";
sha256 = "sha256-I14IHzkloGcDwtARfqi5HwQnVv1uem5dkB6MoamWsiA=";
};
linux-raw-sys = {
crateName = "linux-raw-sys";
version = "0.7.0";
edition = "2021";
sha256 = "sha256-Ubr8C7XL7LntOB51uAMEAwL9Z4tdn6oE8B6qKAvIwCk=";
features = {
bootparam = [];
btrfs = [];
elf_uapi = [];
errno = [];
general = [];
if_arp = [];
if_ether = [];
if_packet = [];
io_uring = [];
ioctl = [];
landlock = [];
loop_device = [];
mempolicy = [];
net = [];
netlink = [];
prctl = [];
ptrace = [];
system = [];
xdp = [];
default = ["std" "general" "errno"];
std = [];
no_std = [];
elf = [];
rustc-dep-of-std = ["core" "compiler_builtins" "no_std"];
};
};
"rustix 0.38.2".dependencies = workspace.internal.crates."rustix 0.38.2".dependencies ++ [
{
name = "linux-raw-sys";
packageId = "linux-raw-sys";
features = ["ioctl"];
}
];
};
};
in buildRustCrates.crates.harpoon;
};
} Seemed like a good time to give up and try something else because clearly something is wrong. |
Well I tried with another similar zellij plugin called room, and it is having the same problem. This is what I would've expected to work: {inputs, ...}: {
perSystem = {inputs', pkgs, system, ...}: {
packages.room = let
toolchain = with inputs'.fenix.packages; combine [minimal.rustc minimal.cargo targets.wasm32-wasip1.latest.rust-std];
# NOTE non-standard flake outputs (i.e. tools) are not cached on inputs'
cargoNix = inputs.crate2nix.tools.${system}.generatedCargoNix {
name = "room";
src = pkgs.fetchFromGitHub {
owner = "rvcas";
repo = "room";
rev = "fd6dc54a46fb9bce21065ce816189c037aeaf24f";
hash = "sha256-T1JNFJUDCtCjXtZQUe1OQsfL3/BI7FUw60dImlUmLhg=";
};
};
workspace = pkgs.callPackage cargoNix {
buildRustCrateForPkgs = pkgs: pkgs.buildRustCrate.override {
rustc = toolchain;
cargo = toolchain;
};
};
in workspace.rootCrate.build;
};
} |
Not strictly relevant, but I do have a working build now without {
perSystem = {inputs', pkgs, ...}: {
packages.harpoon' = pkgs.callPackage ({
lib,
fetchFromGitHub,
rustPlatform,
lld,
}: rustPlatform.buildRustPackage rec {
pname = "harpoon";
version = "0.1.0-git.${lib.substring 0 7 src.rev}";
src = fetchFromGitHub {
owner = "Nacho114";
repo = "harpoon";
rev = "d3284615ba5063c73e0c1729edf5b10b46aead5e";
hash = "sha256-heQ81oZjREU2jMmVG02KJQ6DwnCa7zT1umb5kNENxWY=";
};
cargoHash = "sha256-5b3lvxobzNbu4i4dyMGPnXfiWCENaqX7t8lfSgHQ3Rs=";
depsBuildBuild = [lld];
env.RUSTFLAGS = "-C linker=wasm-ld";
}) {
rustPlatform = let
# NOTE requires stable rust to avoid ahash < 0.8.7 nightly bug (https://github.com/tkaitchuck/aHash/issues/200)
toolchain = with inputs'.fenix.packages; combine [
stable.rustc
stable.cargo
targets.wasm32-wasip1.stable.rust-std
];
in pkgs.pkgsCross.wasi32.makeRustPlatform {
rustc = toolchain;
cargo = toolchain;
};
};
};
} |
Currently trying to package harpoon and testing my builds on
x86_64-linux
. Currently just runningnix run github:nix-community/crate2nix
on the cloned repo, but I have also tried older versions ofcrate2nix
with the same results. The generatedCargo.nix
shows the following foratty
:But trying to build it gives
use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via 'Cargo.toml' instead?
, probably becauselibc
isn't available.atty
does define its dependencies. These are seemingly detected and generated correctly for internal and samplecrate2nix
packages here and here. I have seen other examples around that do not have this same issue as me unfortunately, so not too sure what's going on.The text was updated successfully, but these errors were encountered: