!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

473 Members
Rust115 Servers

Load older messages


SenderMessageTime
3 Sep 2024
@emilazy:matrix.orgemilybut it'd be good to understand what's going on and @mmlb probably knows that better than me :)16:31:46
@kranzes:matrix.orgIlan Joselevich (Kranzes)
In reply to @ultranix:matrix.org
I guess crate2nix wont be able to build with something like this https://github.com/paritytech/polkadot-sdk/blob/master/substrate/utils/wasm-builder/src/builder.rs#L54 that reaches out to the root workspace manifest
right? https://github.com/nix-community/crate2nix/commit/14d9c68123ae2d7ee94f91da28f3bf278c5cff0b
can always do some patching and overriding
17:33:34
@emilazy:matrix.orgemily is there any way to .overrideAttrs a Rust package in practice? I've overridden src and cargoDeps but it just complains about the lock file being out of date for reasons I can't fathom. 20:05:24
@emilazy:matrix.orgemilydoing the equivalent patch to the original package file works.20:05:33
@9hp71n:matrix.orgghpzin How did you override cargoDeps ? 20:11:39
@emilazy:matrix.orgemily I tried cargoDeps = prevAttrs.cargoDeps.overrideAttrs { src = <the new src>; outputHash = "…"; } and it was behaving weird. now I'm trying cargoDeps = pkgs.rustPlatform.fetchCargoTarball { … } and it seems like it might be working? 20:15:03
@emilazy:matrix.orgemilyah, I think I figured out what was going wrong. (flake input overrides acting weirdly.)20:19:30
@emilazy:matrix.orgemily is there a nice way to run clippy in nix flake check? 23:19:20
4 Sep 2024
@getchoo:matrix.orggetchoo
stdenv.mkDerivation {
  name = "check-clippy";
  inherit (aRustPackage) src cargoDeps;

  nativeBuildInputs = [ cargo clippy rustPlatform.cargoSetupHook ];

  buildPhase = "cargo clippy";
}

with aRustPackage being a derivation for the project you're running clippy on

01:51:59
@getchoo:matrix.orggetchoothere are probably ways to do this better/re-use more stuff from the parent package like it's native/buildInputs but01:53:24
@getchoo:matrix.orggetchoohopefully you get the idea lol01:53:29
@getchoo:matrix.orggetchoo *
stdenv.mkDerivation {
  name = "check-clippy";
  inherit (aRustPackage) src cargoDeps;

  nativeBuildInputs = [ cargo clippy rustPlatform.cargoSetupHook ];

  buildPhase = "cargo clippy | tee $out";
}

with aRustPackage being a derivation for the project you're running clippy on

01:53:55
@emilazy:matrix.orgemily right, I ended up doing something like that with runCommandCC since asking :) 01:58:10
@emilazy:matrix.orgemilywas just hoping there was something more "native"01:58:14
@emilazy:matrix.orgemily I considered doing an .overrideAttrs and changing all the phases too 01:58:38
@getchoo:matrix.orggetchooit's not a bad option i just hate disabling some other stuff like the install step lol02:03:27
@emilazy:matrix.orgemilyyeah it's annoying02:04:04
@emilazy:matrix.orgemily
        clippy = config.packages.default.overrideAttrs (prevAttrs: {
          name = "clippy-check";

          nativeBuildInputs = prevAttrs.nativeBuildInputs or [ ] ++ [ pkgs.clippy ];

          dontBuild = true;

          checkPhase = ''
            runHook preCheck
            cargo clippy
            runHook postCheck
          '';

          installPhase = ''
            runHook preInstall
            touch $out
            runHook postInstall
          '';
        });
02:04:12
@emilazy:matrix.orgemily not very pretty, but it seems nicer since it works with buildInputs etc. 02:04:23
@julius:mtx.liftm.deˈt͡sɛːzaɐ̯
nixos login: root (automatic login)
User not known to the underlying authentication module

I'm amazed that that is possible.

03:52:30
@julius:mtx.liftm.deˈt͡sɛːzaɐ̯ I was thinking I could do some fun networking experiments with containers = listToAttrs (genList (idx: { name = "c${toString idx}"; value = /* some container config */; };) 100);, but the time this takes to evaluate is ridiculous. 04:49:14
@prism019:matrix.orgPrism019Redacted or Malformed Event05:25:39
@julius:mtx.liftm.deˈt͡sɛːzaɐ̯Yay, https://github.com/NixOS/nixpkgs/blob/12228ff1752d7b7624a54e9c1af4b222b3c1073b/nixos/modules/virtualisation/nixos-containers.nix#L846-L847 doesn't escape the interface names, so if your interface has a -, the container won't start..05:26:10
@julius:mtx.liftm.deˈt͡sɛːzaɐ̯* Yay, https://github.com/NixOS/nixpkgs/blob/12228ff1752d7b7624a54e9c1af4b222b3c1073b/nixos/modules/virtualisation/nixos-containers.nix#L846-L847 doesn't escape the interface names, so if your interface has a -, the container won't start.. (Time to write a bug report…)05:26:26
@prism019:matrix.orgPrism019Apologies for that, phone was unlocked in my pocket.05:28:59
@julius:mtx.liftm.deˈt͡sɛːzaɐ̯ ("Talk to the hand" was common phrase in my school days to shut someone up. Now I talked to the butt. ;)) 05:32:56
@justastream:matrix.orgStream joined the room.09:45:15
@justastream:matrix.orgStreamhey friends09:45:22
@justastream:matrix.orgStream

I'm really hoping some of you have the technical know-how to help me here, because I really don't want to uninstall NixOs!

For simplicity, all I want is a global install of rustup or oxalica/rust-overlay so I can write Rust code again!

I've got Rust compiling in shell.nix but I'm keen on a global install (I'm a full time Rust engineer) that plays nice with my RustRover IDE.

Setup:

  • OS: NixOs
  • Flakes: enabled
  • IDE: RustRover

Can someone please please help me? I took two days off this week to contribute to OSS and all I've managed is to beat my head against a Nix wall 🙏

09:58:00
@k900:0upti.meK900 Generally, adding rustup to environment.systemPackages should mostly work 09:58:42

Show newer messages


Back to Room ListRoom Version: 6