!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

555 Members
120 Servers

Load older messages


SenderMessageTime
15 Jul 2021
@sternenseemann:systemli.orgsterni piegames: it populates the cross set with the attributes defined in lib/systems/examples.nix 10:34:41
@piegames:matrix.orgpiegames sterni (he/him): Yeah but what if it's not on the list? 11:11:03
@sternenseemann:systemli.orgsterni

since you don't have access to nixpkgsFun it is a bit more cumbersome to emulate, something like this should work:

self: super: {
  pkgsCross = super.pkgsCross // {
    mySystem = import super.path (super.config // {
      crossSystem = mySystemDefinition;
    });
  };
}
11:19:40
@sternenseemann:systemli.orgsterninot sure usually you don't need the pkgsCross attribute desparately since it is the same as passing stuff to the crossSystem argument of nixpkgs11:21:54
@sternenseemann:systemli.orgsterniit's just for convenience, really11:21:59
@piegames:matrix.orgpiegamesI see thank you11:31:51
@piegames:matrix.orgpiegamesWell, it has the disadvantage of having to import nixpkgs twice, since I need some native packages too11:32:12
@sternenseemann:systemli.orgsterni piegames: you can always use buildPackages for that 11:33:16
@piegames:matrix.orgpiegamesOh interesting, I didn't know that11:35:05
@piegames:matrix.orgpiegames Instead of libc = "newlib";, i need to use libnano. Is this generally possible in nixpkgs? 12:26:50
@sternenseemann:systemli.orgsternilibnano is not packaged so no12:27:29
@sternenseemann:systemli.orgsternibut it is not impossible in general :)12:27:37
17 Jul 2021
@symphorien:xlumurb.eusymphorien this PR is probably worth mentionning here: https://github.com/NixOS/nixpkgs/issues/130349 14:01:52
@siraben:matrix.orgsirabenThat seems like a good idea, it's recurring pattern in Nixpkgs and I sometimes have to second-guess what to compare.15:27:02
@symphorien:xlumurb.eusymphorienIt used to exist and was removed so I'd like yo hear why 😃15:57:42
@symphorien:xlumurb.eusymphorienI think there was stdenv.isCross17:23:11
@rick:matrix.ciphernetics.nlRick (Mindavi)
In reply to @symphorien:xlumurb.eu
It used to exist and was removed so I'd like yo hear why 😃
John has a good point
17:24:49
@symphorien:xlumurb.eusymphorienOh that's the reason17:27:00
@rick:matrix.ciphernetics.nlRick (Mindavi)In short: there's no one-size-fits-all solution, and being explicit is better17:41:14
@sternenseemann:systemli.orgsternisometimes you'd need to check targetPlatform equality for example20:53:55
@sternenseemann:systemli.orgsternialso x86_64 -> i686 is still cross compiling, but you could e. g. run tests20:54:18
@sternenseemann:systemli.orgsterniso yeah one size does not fit all20:54:30
18 Jul 2021
@philipp:xndr.dephilipp joined the room.20:25:13
@philipp:xndr.dephilipp Can somebody explain to me where the non 32 bit version of the mingw headers are? One would assume it's pkgsCross.mingwW64.windows.mingw_w64_headers but that evalutes to /nix/store/m7mvg8ldx7fj0rliz60gjyrzy7rm6ig2-mingw-w64-x86_64-w64-mingw32-6.0.0-headers and throws an #error Only Win32 target is supported! error. 20:27:15
@philipp:xndr.dephilipp

Package for reference:

{ stdenv, lib, fetchFromGitHub, glslang, meson, ninja, wine, pkgsCross }:

stdenv.mkDerivation rec {
  pname = "dxvk-installer";
  version = "1.9";

  src = fetchFromGitHub {
    owner = "doitsujin";
    repo = "dxvk";
    rev = "v${version}";
    sha256 = "01db23ncbrrq0cqnp25fg5plp88v5i5ri0i38m0wida8mw3mmjsa";
  };

  mesonFlags = [ "--cross-file build-win64.txt" "--buildtype release" ];
  nativeBuildInputs = [
    glslang
    meson
    ninja
    pkgsCross.mingwW64.buildPackages.gcc
    pkgsCross.mingwW64.windows.mingw_w64
    pkgsCross.mingwW64.windows.mingw_w64_headers
    wine
  ];
}
20:27:52
@philipp:xndr.dephilipp *

Package for reference:

{ stdenv, lib, fetchFromGitHub, glslang, meson, ninja, wine, pkgsCross }:

stdenv.mkDerivation rec {
  pname = "dxvk-installer";
  version = "1.9";

  src = fetchFromGitHub {
    owner = "doitsujin";
    repo = "dxvk";
    rev = "v${version}";
    sha256 = "01db23ncbrrq0cqnp25fg5plp88v5i5ri0i38m0wida8mw3mmjsa";
  };

  mesonFlags = [ "--cross-file build-win64.txt" "--buildtype release" ];
  nativeBuildInputs = [
    glslang
    meson
    ninja
    pkgsCross.mingwW64.buildPackages.gcc
    pkgsCross.mingwW64.windows.mingw_w64_headers
    wine
  ];
}
20:52:35
19 Jul 2021
@symphorien:xlumurb.eusymphorien You need to take all your packages from pkgCross.ming.... 05:29:30
@symphorien:xlumurb.eusymphorienThe easiest way is to take callPackage from it like in https://nixos.wiki/wiki/Cross_Compiling05:31:46
@philipp:xndr.dephilippthx, will look into that.08:18:33
@philipp:xndr.dephilipp

I ended up with

{ stdenv, lib, fetchFromGitHub, glslang, meson, ninja,  pkgsCross, gcc, buildPackages }:

stdenv.mkDerivation rec {
  pname = "dxvk-installer";
  version = "1.9";

  src = fetchFromGitHub {
    owner = "doitsujin";
    repo = "dxvk";
    rev = "v${version}";
    sha256 = "01db23ncbrrq0cqnp25fg5plp88v5i5ri0i38m0wida8mw3mmjsa";
  };

  mesonFlags = [ "--cross-file build-win64.txt" "--buildtype release" ];
  depsBuildBuild = [ buildPackages.stdenv.cc buildPackages.meson buildPackages.ninja ];
  depsBuildTarget = [
    pkgsCross.mingwW64.windows.mingw_w64_headers
    glslang
    buildPackages.gcc
  ];
}

called via nix-build -E 'with import <nixpkgs> {}; pkgsCross.mingwW64.callPackage ./dxvk.nix { }' but I still end up with the same error. Do I have to get mingwW64 from somewhere else now? I can't find it.

15:00:17

Show newer messages


Back to Room ListRoom Version: 6