!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

520 Members
Rust116 Servers

Load older messages


SenderMessageTime
2 Jan 2025
@antrz:matrix.organtrzThank you. I will try that now20:35:48
@antrz:matrix.organtrzah! i guess i need the patches too20:39:12
@tomasajt:matrix.orgTomaoh, yeah, forgot about those20:39:25
@antrz:matrix.organtrzIt's a little bit over doing it, but it seems to work. hopefully the nixpkg gets refactored in a nicer way20:42:27
@antrz:matrix.organtrzsoon20:42:29
@antrz:matrix.organtrzbuilding this derivation feels like building the entire universe21:11:18
@niklaskorz:korz.devNiklas Korzit would work a lot better if buildRustPackage had something like stdenv's finalAttrs21:51:38
@niklaskorz:korz.devNiklas Korzhm not sure why the override for cargoHash is not working21:55:24
@niklaskorz:korz.devNiklas Korzoh wow there are four different PRs attempting an implementation by now 🥲21:57:54
@antrz:matrix.organtrzdamn! hopefully one of them works :D21:58:37
@niklaskorz:korz.devNiklas Korzhm yeah cargoHash with useFetchCargoVendor is seemingly impossible to override atm22:02:58
@niklaskorz:korz.devNiklas Korz

antrz: this is the smallest working override I could come up with:

pkgs.zed-editor.overrideAttrs (
  finalAttrs: prevAttrs: {
    version = "0.168.0-pre";
    src = prevAttrs.src.override {
      tag = "v${finalAttrs.version}";
      hash = "sha256-GcsK64tJrEp1QVcLJV2xTWAzupmNXsMgzzW5KOEFqTI=";
    };
    postPatch = ''
      substituteInPlace ../${finalAttrs.pname}-${finalAttrs.version}-vendor/webrtc-sys-*/build.rs \
        --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc"
    '';
    cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
      inherit (finalAttrs) pname version src;
      hash = "sha256-EuQhqTz200P5xfJGowP1jZxbyJbE2Nl3hm2wVubdOOM=";
    };
    env.RELEASE_VERSION = finalAttrs.version;
  }
)
22:17:27
@niklaskorz:korz.devNiklas Korzthe postPatch override unfortunately is necessary because it also references the version22:17:44
@niklaskorz:korz.devNiklas Korzoh no I still get a build failure in the end 🫠22:20:14
@antrz:matrix.organtrzThat's really great! Thank you. I will try that soon22:20:16
@antrz:matrix.organtrzah!22:20:23
@antrz:matrix.organtrzokay22:20:25
@niklaskorz:korz.devNiklas Korzoh, ups22:21:31
@niklaskorz:korz.devNiklas KorzI know why, one sec22:21:34
@niklaskorz:korz.devNiklas Korz

env.RELEASE_VERSION = finalAttrs.version; should be:

    env = prevAttrs.env // {
      RELEASE_VERSION = finalAttrs.version;
    };
22:22:10
@niklaskorz:korz.devNiklas Korz *

antrz: this is the smallest working override I could come up with:

pkgs.zed-editor.overrideAttrs (
  finalAttrs: prevAttrs: {
    version = "0.168.0-pre";
    src = prevAttrs.src.override {
      tag = "v${finalAttrs.version}";
      hash = "sha256-GcsK64tJrEp1QVcLJV2xTWAzupmNXsMgzzW5KOEFqTI=";
    };
    postPatch = ''
      substituteInPlace ../${finalAttrs.pname}-${finalAttrs.version}-vendor/webrtc-sys-*/build.rs \
        --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc"
    '';
    cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
      inherit (finalAttrs) pname version src;
      hash = "sha256-EuQhqTz200P5xfJGowP1jZxbyJbE2Nl3hm2wVubdOOM=";
    };
    env = prevAttrs.env // {
      RELEASE_VERSION = finalAttrs.version;
    };
  }
)
22:22:44
@antrz:matrix.organtrzbuilding 167 right now. I will try that after22:27:27
@niklaskorz:korz.devNiklas Korzversion has to 0.168.0 without -pre23:11:41
@niklaskorz:korz.devNiklas Korz *

antrz: this is the smallest working override I could come up with:

pkgs.zed-editor.overrideAttrs (
  finalAttrs: prevAttrs: {
    version = "0.168.0";
    src = prevAttrs.src.override {
      tag = "v${finalAttrs.version}-pre";
      hash = "sha256-GcsK64tJrEp1QVcLJV2xTWAzupmNXsMgzzW5KOEFqTI=";
    };
    postPatch = ''
      substituteInPlace ../${finalAttrs.pname}-${finalAttrs.version}-vendor/webrtc-sys-*/build.rs \
        --replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc"
    '';
    cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
      inherit (finalAttrs) pname version src;
      hash = "sha256-EuQhqTz200P5xfJGowP1jZxbyJbE2Nl3hm2wVubdOOM=";
    };
    env = prevAttrs.env // {
      RELEASE_VERSION = finalAttrs.version;
    };
  }
)
23:11:53
@niklaskorz:korz.devNiklas Korz *

antrz: this is the smallest working override I could come up with:

pkgs.zed-editor.overrideAttrs (
  finalAttrs: prevAttrs: {
    version = "0.168.0";
    src = prevAttrs.src.override {
      tag = "v${finalAttrs.version}-pre";
      hash = "sha256-GcsK64tJrEp1QVcLJV2xTWAzupmNXsMgzzW5KOEFqTI=";
    };
    postPatch =
      builtins.replaceStrings [ prevAttrs.version ] [ finalAttrs.version ]
        prevAttrs.postPatch;
    cargoDeps = pkgs.rustPlatform.fetchCargoVendor {
      inherit (finalAttrs) pname version src;
      hash = "sha256-EuQhqTz200P5xfJGowP1jZxbyJbE2Nl3hm2wVubdOOM=";
    };
    env = prevAttrs.env // {
      RELEASE_VERSION = finalAttrs.version;
    };
  }
)
23:22:37
@niklaskorz:korz.devNiklas Korz* version has to be 0.168.0 without -pre (otherwise install check fails)23:23:02
3 Jan 2025
@antrz:matrix.organtrz
In reply to @niklaskorz:korz.dev
version has to be 0.168.0 without -pre (otherwise install check fails)
Thanks a lot, but aaaah wasted a lot of time compiling 😅
00:16:53
@antrz:matrix.organtrzWorks like a charm, btw. Appreciate it :)08:44:27
@tomasajt:matrix.orgTomaRedacted or Malformed Event14:33:20
@tomasajt:matrix.orgToma

It is possible, though it wouldn't get a new version value, so it's only ever useful if you use fetchCargoVendor separately.

some-package.overrideAttrs
  (prevAttrs: {
    cargoDeps = prevAttrs.cargoDeps.overrideAttrs (prevDepsAttrs: {
      vendorStaging = prevDepsAttrs.vendorStaging.overrideAttrs {
        outputHash = "new-hash";
      };
    });
  })

Also, fetchCargoTarball has the same issue when used internally by buildRustPackage, but it's a bit easier to override at least

14:35:41

Show newer messages


Back to Room ListRoom Version: 6