!OqhvaDMJdKYUicLDiE:nixos.org

Nixpkgs Stdenv

188 Members
59 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
25 May 2025
@rosscomputerguy:matrix.orgTristan RossYeah, ideally no cross when possible.02:33:26
@rosscomputerguy:matrix.orgTristan Ross From what I was able to gleam when trying to test the wasm cross stdenv, it looks like it's only necessary for sandboxing things in a way? We could provide an option but idk if it's worth it. 02:34:48
@rosscomputerguy:matrix.orgTristan Ross

crossStdenv.predicated.useLLVM.configs.wasm32-unknown-wasi

{
  "cpuTime": 0.8086940050125122,
  "envs": {
    "bytes": 9276688,
    "elements": 643991,
    "number": 515595
  },
  "gc": {
    "cycles": 1,
    "heapSize": 402915328,
    "totalBytes": 113596128
  },
  "list": {
    "bytes": 1192696,
    "concats": 14033,
    "elements": 149087
  },
  "nrAvoided": 507605,
  "nrExprs": 191950,
  "nrFunctionCalls": 489091,
  "nrLookups": 246990,
  "nrOpUpdateValuesCopied": 2948940,
  "nrOpUpdates": 28801,
  "nrPrimOpCalls": 197474,
  "nrThunks": 490984,
  "sets": {
    "bytes": 57271296,
    "elements": 3526449,
    "number": 53007
  },
  "sizes": {
    "Attr": 16,
    "Bindings": 16,
    "Env": 8,
    "Value": 24
  },
  "symbols": {
    "bytes": 446123,
    "number": 42055
  },
  "time": {
    "cpu": 0.8086940050125122,
    "gc": 0.101,
    "gcFraction": 0.12489272750134622
  },
  "values": {
    "bytes": 29123448,
    "number": 1213477
  }
}

pkgsCross.wasi32.stdenv

{
  "cpuTime": 1.1445599794387817,
  "envs": {
    "bytes": 11093168,
    "elements": 793274,
    "number": 593372
  },
  "gc": {
    "cycles": 1,
    "heapSize": 402915328,
    "totalBytes": 257411904
  },
  "list": {
    "bytes": 3087112,
    "concats": 17218,
    "elements": 385889
  },
  "nrAvoided": 634315,
  "nrExprs": 191436,
  "nrFunctionCalls": 554713,
  "nrLookups": 216783,
  "nrOpUpdateValuesCopied": 6831370,
  "nrOpUpdates": 46625,
  "nrPrimOpCalls": 194292,
  "nrThunks": 908524,
  "sets": {
    "bytes": 146253904,
    "elements": 8929195,
    "number": 211674
  },
  "sizes": {
    "Attr": 16,
    "Bindings": 16,
    "Env": 8,
    "Value": 24
  },
  "symbols": {
    "bytes": 446471,
    "number": 42080
  },
  "time": {
    "cpu": 1.1445599794387817,
    "gc": 0.20500000000000002,
    "gcFraction": 0.17910813210550902
  },
  "values": {
    "bytes": 67181760,
    "number": 2799240
  }
}
02:36:27
@emilazy:matrix.orgemilyRLBox is important, I mean what's the reason it can't use an unwrappd multi-target Clang?02:50:40
@emilazy:matrix.orgemily it uses libcxx for WASM, I guess? but does it use anything else from pkgsCross? 02:50:52
@rosscomputerguy:matrix.orgTristan RossYeah, idk02:51:04
@rosscomputerguy:matrix.orgTristan RossI think it needs wasilibc02:52:01
@rosscomputerguy:matrix.orgTristan RossOk yeah, it needs a wasm toolchain. It looks like upstream uses the wasi-sdk.02:54:37
@reckenrode:matrix.orgRandy Eckenrode How does crossStdenv handle cross-compiled dependencies? DXVK needs SPIRV and Vulkan headers and windows.pthreads. 13:39:07
@reckenrode:matrix.orgRandy Eckenrode Also, how does it handle NIX_ vars? Does this even work with Darwin since Darwin needs an SDK? 13:44:42
@rosscomputerguy:matrix.orgTristan Ross
In reply to @reckenrode:matrix.org
Also, how does it handle NIX_ vars? Does this even work with Darwin since Darwin needs an SDK?
Suffix salt should work with the env vars. Idk about Darwin but it could be made to work.
14:28:05
@rosscomputerguy:matrix.orgTristan Ross
In reply to @reckenrode:matrix.org
How does crossStdenv handle cross-compiled dependencies? DXVK needs SPIRV and Vulkan headers and windows.pthreads.
You'll have to override the stdenv for the dependencies.
14:28:23
@reckenrode:matrix.orgRandy Eckenrode
In reply to @rosscomputerguy:matrix.org
You'll have to override the stdenv for the dependencies.
That doesn’t seem like an improvement.
14:29:31
@rosscomputerguy:matrix.orgTristan Ross
In reply to @reckenrode:matrix.org
That doesn’t seem like an improvement.
I don't see really any other way of doing cross without either creating a new nixpkgs instance (what we already have) or only provide cross compilation stdenv's
14:30:30
@reckenrode:matrix.orgRandy Eckenrode

DXVK uses a custom MinGW (with the Win32 thread model instead of the POSIX one). When you build dxvk on Darwin or Linux, it uses the cross-compiled 32- and 64-bit MinGW DLLs.

https://github.com/NixOS/nixpkgs/blob/6fb6fd3ceff99de72d881f1a97773647c94e5a82/pkgs/by-name/dx/dxvk/package.nix#L28-L44

DXVK itself has dependencies: spirv-headers and vulkan-headers. Fortunately, those do not have transitive dependencies. (Arguably, DXVK has more dependencies, but I didn’t bother to de-vendor them.)

https://github.com/NixOS/nixpkgs/blob/6fb6fd3ceff99de72d881f1a97773647c94e5a82/pkgs/by-name/dx/dxvk_2/package.nix#L74-L81

The replacement sounds like I need to manually enumerate the transitive dependencies of DXVK, replace all of their stdenvs and make sure they get the right dependencies themselves (thankfully easy for DXVK since they have none themselves).

15:08:53
@reckenrode:matrix.orgRandy Eckenrode crossStdenv is still expensive, but now the maintainability of my package has gone down because I have more work to do to build my package instead of just referencing pkgsCross.mingw32.dxvk_2 and pkgsCross.mingwW64.dxvk_2. 15:09:59
@reckenrode:matrix.orgRandy Eckenrode Note that it’s not possible to write a function to replace inputs that works in all cases because not all dependencies are in buildInputs (or propagatedBuildInputs). It’s the same problem that overrideSDK had. 15:15:22

Show newer messages


Back to Room ListRoom Version: 9