!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

520 Members
Rust116 Servers

Load older messages


SenderMessageTime
24 Dec 2024
@r522:matrix.org522 it's literally just unsafeWindow.document.location.href = 'https://wiki.nixos.org' + unsafeWindow.document.location.href.replace(/^http?s:\/\/nixos\.wiki/, '') set to run on nixos.wiki pages 23:29:59
25 Dec 2024
@benjamin:computer.surgeryolivia left the room.00:22:16
@tanja:catgirl.cloudTanja (she/her) changed their display name from Tanja (she/her) to Tanja (she/her) [DECT 6929].14:47:56
26 Dec 2024
@10leej:matrix.org@10leej:matrix.org joined the room.01:41:12
@10leej:matrix.org@10leej:matrix.org left the room.01:41:57
@pim:envs.netpim joined the room.09:48:09
@pim:envs.netpim

Hi folks, I want to experiment with eBPF on NixOS and I noticed bpfman does what I want to do. The project is written in Rust but not yet packaged in Nix, so I am taking a stab at it. However, I am encountering an issue with a dependency:

❯ nix build .#bpfman
warning: Git tree '/home/pim/git/forks/nixpkgs' is dirty
error: builder for '/nix/store/b8216af5njppj5n96aw7m22gvh62fyk7-bpfman-0.5.4.drv' failed with exit code 101;
       last 25 log lines:
       > Caused by:
       >   process didn't exit successfully: `/build/source/target/release/build/aya-rustc-llvm-proxy-9b328a409e2e9087/build-script-build` (exit status: 101)
       >   --- stderr
       >   thread 'main' panicked at /build/bpfman-0.5.4-vendor/aya-rustc-llvm-proxy-0.9.3/build.rs:10:10:
       >   Unable to parse 'llvm-sys' crate: Unable to get crate metadata
       >
       >   Caused by:
       >       `cargo metadata` exited with an error: error: failed to get `libc` as a dependency of package `aya-rustc-llvm-proxy v0.9.3 (/build/bpfman-0.5.4-vendor/aya-rustc-llvm-proxy-0.9.3)`
       >
       >       Caused by:
       >         failed to load source for dependency `libc`
       >
       >       Caused by:
       >         Unable to update registry `crates-io`
       >
       >       Caused by:
       >         failed to update replaced source registry `crates-io`
       >
       >       Caused by:
       >         failed to read root of directory source: /build/bpfman-0.5.4-vendor/@vendor@
       >
       >       Caused by:
       >         No such file or directory (os error 2)
       >
       >   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
       For full logs, run 'nix log /nix/store/b8216af5njppj5n96aw7m22gvh62fyk7-bpfman-0.5.4.drv'.
11:19:29
@pim:envs.netpimSo I figure it's complaining about https://github.com/aya-rs/rustc-llvm-proxy/blob/main/Cargo.toml11:20:40
@pim:envs.netpimDoes anybody have any pointers?11:21:52
@robin:icewind.nlIcewind Doing a basic buildRustPackage just seems to work: https://bin.icewind.me/p/6q7tK8.nix 13:20:28
@pim:envs.netpim I think you forgot to replace the repo in your pastebin with bpfman 16:12:12
@pim:envs.netpim I'm also using a basic buildRustPackage, I'll paste my definition in this thread 16:13:36
@pim:envs.netpim
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  llvmPackages_12,
  pkg-config,
  openssl,
  ...
}:
rustPlatform.buildRustPackage rec {
  pname = "bpfman";
  version = "0.5.4";

  src = fetchFromGitHub {
    owner = "bpfman";
    repo = "bpfman";
    rev = "refs/tags/v${version}";
    hash = "sha256-CRYp1ktmmY4OS23+LNKOBQJUMkd+GXptBp5LPfbyZAc=";
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-sLxDj4ftc6te67wnYE7bXWC8O+CMVk9lVrLcQT5Q0gk=";

  doCheck = false;

  nativeBuildInputs = [ llvmPackages_12.llvm pkg-config ];
  buildInputs = [openssl];

  meta = with lib; {
    description = "An eBPF Manager for Linux and Kubernetes";
    mainProgram = "bpfman";
    homepage = "https://bpfman.io";
    license = with licenses; [
      # asl20
      # bsd2
      # gpl2Only
    ];
    maintainers = with maintainers; [  ];
    # broken = stdenv.buildPlatform != stdenv.hostPlatform;
  };
}
16:13:47
@pim:envs.netpim *
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  llvmPackages_12,
  pkg-config,
  openssl,
  ...
}:
rustPlatform.buildRustPackage rec {
  pname = "bpfman";
  version = "0.5.4";

  src = fetchFromGitHub {
    owner = "bpfman";
    repo = "bpfman";
    rev = "refs/tags/v${version}";
    hash = "sha256-CRYp1ktmmY4OS23+LNKOBQJUMkd+GXptBp5LPfbyZAc=";
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-sLxDj4ftc6te67wnYE7bXWC8O+CMVk9lVrLcQT5Q0gk=";

  doCheck = false;

  nativeBuildInputs = [ llvmPackages_12.llvm pkg-config ];
  buildInputs = [openssl];
}
16:14:10
@robin:icewind.nlIcewind
In reply to @pim:envs.net
I think you forgot to replace the repo in your pastebin with bpfman
you're right, but I did prefetch the correct hash so the package is still correct
16:31:43
@robin:icewind.nlIcewind did you by any chance forget to update the hash? there is no reference to llvm-proxy in the projects cargo.lock 16:33:26
@pim:envs.netpimOmg you're right 😅 I was expecting it to complain about a hash clash but of course it doesn't. Thanks!17:16:33
@sneid:matrix.orgDenis Natusch joined the room.22:20:54
27 Dec 2024
@rhelmot:matrix.orgrhelmot joined the room.00:55:15
@rhelmot:matrix.orgrhelmotI opened https://github.com/rust-lang/rust/issues/134811 against rustc while trying to debug https://github.com/NixOS/nixpkgs/pull/356769 if anyone here wants to save the rust people some pain00:55:39
@rhelmot:matrix.orgrhelmot(x-post from the nix cross compiling channel)00:55:54
@raitobezarius:matrix.orgraitobezarius changed their display name from raitobezarius to raitobezarius (DECT: 3538 / EPVPN 2681).07:32:40
@tilpner:tx0.cotilpner changed their display name from tilpner to tilpner (38c3 3209).09:41:08
28 Dec 2024
@dmoonfire:matrix.org@dmoonfire:matrix.org left the room.06:13:52
@siraben:matrix.orgsiraben left the room.06:19:59
@ronnypfannschmidt:matrix.org@ronnypfannschmidt:matrix.org left the room.17:57:41
29 Dec 2024
@luke:vuksta.comLuke This has probably been asked before, but what is the right way to use a nightly toolchain with crane? I don't see it from a cursory search 01:31:24
@luke:vuksta.comLuke Do I need to override the toolchain that crane.mkLib pkgs uses? 01:35:06
@robin:icewind.nlIcewind
In reply to @luke:vuksta.com
This has probably been asked before, but what is the right way to use a nightly toolchain with crane? I don't see it from a cursory search
(crane.mkLib pkgs).overrideToolchain (pkgs: ...) should do it.
02:53:04
@luke:vuksta.comLuke Yeah, I did try this but hit a problem finding the rust-bin package, which is what I think needs to be overwritten? I haven't touched rust in a minute... 06:31:13

Show newer messages


Back to Room ListRoom Version: 6