!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

539 Members
111 Servers

Load older messages


SenderMessageTime
25 Nov 2025
@artturin:matrix.orgArtturincool18:55:16
@ebnull:matrix.orgeb

I cross compile to my raspis

What configuration settings do you use here? I'm new to this one too, and I see I can choose (mainline | proprietary) kernel, (nixpkgs stable | nix-hardware | raspberry-pi-nix) for hardware support.

18:58:52
@ebnull:matrix.orgebThis particular pi is a 4b and will be headless, so I don't need to have much desktopy stuff on it18:59:20
@artturin:matrix.orgArtturinThe biggest obstacle to making it all automatic with nix-forecast and a script is nested attrs but just changing the top-level attrs will increase the cache hits by a lot18:59:45
@artturin:matrix.orgArtturin
  boot = {
    supportedFilesystems = {
      btrfs = lib.mkForce false;
      cifs = lib.mkForce false;
      f2fs = lib.mkForce false;
      ntfs = lib.mkForce false;
      xfs = lib.mkForce false;
      zfs = lib.mkForce false;
    };
    # Make the kernel much lighter to build, otherwise needs 30G+ ram
    kernelPatches = [
      {
        name = "disable-bpf";
        patch = null;
        extraConfig = ''
          DEBUG_INFO_BTF n
          CONFIG_DEBUG_INFO_BTF n
        '';
      }
    ];
    initrd.allowMissingModules = true;

    tmp.useTmpfs = true;
  };

Didn't change the kernel

19:00:42
@ebnull:matrix.orgeb

obstacle to making it all automatic with nix-forecast

I figured the biggest issue would be that it's not easy to map cached store paths back to attr / package names

19:01:01
@artturin:matrix.orgArtturin

Also got these to not compile gtk

  nixpkgs.overlays = [
    (final: prev: {
      stoken = prev.stoken.override { withGTK3 = false; };
      alsa-utils = prev.alsa-utils.override {
        withPipewireLib = false;
        fftw = null;
      };
      alsa-plugins = prev.alsa-plugins.override {
        libpulseaudio = null;
        speexdsp = null;
      };
      sdl2 = prev.sdl2.override {
        pipewireSupport = false;
        pulseaudioSupport = false;
        x11Support = false;
        jackSupport = false;
      };
      ffmpeg = prev.ffmpeg_7-headless.override {
        withSpeex = false;
        withOpenmpt = false;
      };
    })
  ];
19:01:04
@artturin:matrix.orgArtturin *

Also got these to not compile gtk and some other packages

  nixpkgs.overlays = [
    (final: prev: {
      stoken = prev.stoken.override { withGTK3 = false; };
      alsa-utils = prev.alsa-utils.override {
        withPipewireLib = false;
        fftw = null;
      };
      alsa-plugins = prev.alsa-plugins.override {
        libpulseaudio = null;
        speexdsp = null;
      };
      sdl2 = prev.sdl2.override {
        pipewireSupport = false;
        pulseaudioSupport = false;
        x11Support = false;
        jackSupport = false;
      };
      ffmpeg = prev.ffmpeg_7-headless.override {
        withSpeex = false;
        withOpenmpt = false;
      };
    })
  ];
19:01:10
@artturin:matrix.orgArtturin And I import (modulesPath + "/profiles/minimal.nix") 19:02:51
@artturin:matrix.orgArtturinJust updated my raspi and took me 1H to compile everything on r5 5900x19:03:35
@artturin:matrix.orgArtturin* Just updated my raspi and took me 1H to compile everything on r9 5900x19:03:42
@ebnull:matrix.orgebThanks for all the info!19:06:35
@artturin:matrix.orgArtturin

eb:

(
  { config, pkgs, ... }:
  {
    options.nixpkgsNative.pkgs = lib.mkOption {
      type = lib.types.pkgs;
      default = null;
      description = "Native nixpkgs for the system being cross-compiled to get native packages to reduce build amounts";
    };
                                                                                                                         
    config.nixpkgsNative.pkgs = import pkgs.path {
      localSystem = config.nixpkgs.crossSystem;
      inherit (config.nixpkgs) crossSystem config;
    };
                                                                                                                         
  }
)

config.nixpkgsNative.pkgs.mpv-unwrapped

20:51:23
@artturin:matrix.orgArtturinmade this thing so I can pass the native pkgs around without using specialArgs20:51:39
@ebnull:matrix.orgeb

Nice, ty.

I did a similar thing to avoid specialArgs, but with pkgs.unstable as an overlay for nixpkgs-unstable when I needed it downstream for other reasons.

21:51:05
26 Nov 2025
@rick:matrix.ciphernetics.nlMindavi joined the room.11:56:47
@artturin:matrix.orgArtturinhttps://github.com/NixOS/nixpkgs/pull/46509221:48:02
27 Nov 2025
@szlend:matrix.orgszlendHow come this is an issue with CGO disabled? It shouldn’t use CC at all07:55:18
@artturin:matrix.orgArtturinYesterday I found an issue somewhere which IIRC mentioned something about something trying to use CGO/compiler even when it's off17:32:21
@artturin:matrix.orgArtturinI'm trying to find it again17:32:28
@artturin:matrix.orgArtturinThat likely is the root cause of the issue as before just disabling CGO and unsetting GOARCH was enough https://github.com/nixos/nixpkgs/commit/78b312a895f8368746318bacb2634a151e8ea6ae17:38:09
@szlend:matrix.orgszlendMaybe this will fix it? https://github.com/NixOS/nixpkgs/pull/458867/19:54:37
@szlend:matrix.orgszlendOr maybe even https://github.com/NixOS/nixpkgs/pull/46161519:55:17
@artturin:matrix.orgArtturinscreenshot_2025-11-27_22-25-29_895546503.png
Download screenshot_2025-11-27_22-25-29_895546503.png
20:26:07
@artturin:matrix.orgArtturin Both are in unstable already :P 20:28:32
@artturin:matrix.orgArtturinThe first one probably fixed it20:28:52
@artturin:matrix.orgArtturinBut was reverted20:29:14
@artturin:matrix.orgArtturinWell maybe not, I don't see anything that would have fixed it20:36:43
@artturin:matrix.orgArtturinIt used to work in August20:37:15
@artturin:matrix.orgArtturinWorking fbcf476f790d8a217c3eab4e12033dc4a0f6d23c Not working 050e09e091117c3d7328c7b2b7b577492c43c13420:44:41

There are no newer messages yet.


Back to Room ListRoom Version: 6