!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

635 Members
Rust147 Servers

Load older messages


SenderMessageTime
3 Nov 2025
@crop_tech:matrix.orgcrop

i am trying to build rustfilt with this:

  rustfilt = pkgs.rustPlatform.buildRustPackage rec {
    pname = "rustfilt";
    version = "0.2.1";

    src = pkgs.fetchCrate {
      inherit pname version;
      sha256 = "sha256-Xo6qM2qdzkvoLkOsxksKdpi1rkpBKPGrPxz4zJ3EVyY=";
    };

    cargoHash = "";
    cargoDepsName = pname;
  };

but the problem is that the package doesn't contain a cargo lock file
so it fails in fetch-cargo-vendor-util

11:26:41
@crop_tech:matrix.orgcropi tried to use the src from github but i now run into this problem: https://github.com/NixOS/nixpkgs/issues/39287212:41:11
@crop_tech:matrix.orgcropok solved by switching to master and not use the taged version12:49:36
@acidbong:envs.netAcid Bong
In reply to @crop_tech:matrix.org

i am trying to build rustfilt with this:

  rustfilt = pkgs.rustPlatform.buildRustPackage rec {
    pname = "rustfilt";
    version = "0.2.1";

    src = pkgs.fetchCrate {
      inherit pname version;
      sha256 = "sha256-Xo6qM2qdzkvoLkOsxksKdpi1rkpBKPGrPxz4zJ3EVyY=";
    };

    cargoHash = "";
    cargoDepsName = pname;
  };

but the problem is that the package doesn't contain a cargo lock file
so it fails in fetch-cargo-vendor-util

fetch the crate (or clone the repo), generate the lockfile (cargo generate-lockfile), put the lockfile in your nix config and change cargo* attrs to cargoLock.lockFile = ./Cargo.lock;
13:06:25
@makuru:catgirl.cloudMakuru Why does rustc build for me but fenix not? 15:35:46
@makuru:catgirl.cloudMakuruHere the flake:15:36:16
@makuru:catgirl.cloudMakuruDownload flake.nix15:36:16
@makuru:catgirl.cloudMakuruWhat brakes me is that the shell isnt working but the package does?15:37:21
@makuru:catgirl.cloudMakuru Here the error:
  = note:  "cc" "-m64" "/tmp/nix-shell.dAjGsj/rustcl8zW27/symbols.o" "<3 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/nix-shell.dAjGsj/rustcl8zW27/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/framework-16/Documents/ALVR/target/debug/build/serde-77f00400c2754ee5/build_script_build-77f00400c2754ee5" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-Wl,--push-state,--no-as-needed" "-lwayland-client" "-lxkbcommon" "-Wl,--pop-state"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: Could not start dynamically linked executable: /nix/store/r375wnhlcgs833kc7jcdimsn4ch8niyq-rust-mixed/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/ld.lld
          NixOS cannot run dynamically linked executables intended for generic
          linux environments out of the box. For more information, see:
          https://nix.dev/permalink/stub-ld
          clang: error: unable to execute command: No such file or directory
          clang: error: linker command failed due to signal (use -v to see invocation)
          

error: could not compile `serde` (build script) due to 1 previous error
15:37:45
@makuru:catgirl.cloudMakuruHuh? what why?15:38:58
@makuru:catgirl.cloudMakuruWhy it starting a non linked but linked bin, from the nix store?15:39:27
@makuru:catgirl.cloudMakuruWhy does it work with rustc but not with fenix?16:05:10
@makuru:catgirl.cloudMakuruWhere does rustc change stuff?16:05:26
@dacid44:matrix.orgdacid44 How do I manage binaries from crates.io with nix? like, stuff I'd usually install by running cargo install cargo-make 16:51:26
@dacid44:matrix.orgdacid44if it matters, I'm currently using fenix for my Rust toolchain16:53:28
@dacid44:matrix.orgdacid44 also, was cargo-make removed from nixpkgs? I have an old project that pulls it from nixpkgs just fine, but it doesn't appear to exist there anymore 16:58:16
@dacid44:matrix.orgdacid44 * also, was cargo-make removed from nixpkgs? I have an old project that pulls it from nixpkgs (24) just fine, but it doesn't appear to exist there anymore 16:58:27
@benjaminsparks:chat.alugha.appBen Sparkswell ideally they'd be packaged in nixpkgs, so just an install like any other16:58:32
@dacid44:matrix.orgdacid44 * also, was cargo-make removed from nixpkgs? I have an old project that pulls it from nixpkgs (24.05) just fine, but it doesn't appear to exist there anymore 16:58:34
@dacid44:matrix.orgdacid44 cargo-make seems to have been removed from nixpkgs 16:59:16
@dacid44:matrix.orgdacid44 * cargo-make seems to have been removed from nixpkgs? 16:59:35
@ghpzin:envs.netghpzin Still there on current master, search.nixos.org is just having problems. 17:01:21
@dacid44:matrix.orgdacid44ah. Yeah I just tried it in my home-manager config and it worked17:01:40
@dacid44:matrix.orgdacid44 in general though, how would I do that for something that hasn't been packaged already? Do I have to fully package it myself, or is there a way to just plug in the name on crates.io and maybe a rust toolchain derivation or something and have it be built and installed as if by cargo install? 17:04:42
@ghpzin:envs.netghpzin Packaging it yourself.
https://github.com/nix-community/nix-init
can help for simpler cases
But things like adding required native libraries or patching weird build.rs things would need manual fixes after.
17:10:30
@makuru:catgirl.cloudMakuru Figured it out! Needed to add llvmPackages.bintools. 17:40:48
@makuru:catgirl.cloudMakuru and this: RUSTFLAGS -C link-self-contained=-linker 17:41:25
4 Nov 2025
@cafkafk:gitter.imcafkafk changed their profile picture.08:22:50
@whispers:catgirl.cloudwhispers (it/fae) joined the room.20:06:43
@dawnofmidnight:catgirl.cloud@dawnofmidnight:catgirl.cloud left the room.20:06:49

There are no newer messages yet.


Back to Room ListRoom Version: 6