!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

581 Members
129 Servers

Load older messages


SenderMessageTime
18 Mar 2025
@fzakaria:one.ems.hostfzakariato avoid "mass rebuilds" -- it's so fragile. I tried moving things to overlay and too much borked19:16:18
19 Mar 2025
@xokdvium:matrix.orgSergei Zimmerman (xokdvium) changed their display name from xokdvium to Sergei Zimmerman (xokdvium).21:12:18
21 Mar 2025
@domenkozar:matrix.orgDomen Kožar changed their profile picture.11:41:12
24 Mar 2025
@rhelmot:matrix.orgrhelmotI'm having trouble parsing the logic behind hostOffset in setup hooks. Is the idea that if I'm currently running for a package that was brought in as a buildInput it'll be 0 and if it's a nativeBuildInput it'll be 1?01:52:53
@Ericson2314:matrix.orgJohn Ericson-1 for native build input iirc?03:09:34
@Ericson2314:matrix.orgJohn EricsonBut I could forget 03:09:38
26 Mar 2025
@rosssmyth:matrix.org@rosssmyth:matrix.org

Is there an example somewhere of where multilib + crosspkgs is broken? From #380325

What would it take to fix it?

18:57:13
@stephen:crabsin.spacen3tcat joined the room.18:57:22
@stephen:crabsin.spacen3tcat 19:00:25
@stephen:crabsin.spacen3tcat 19:01:16
@stephen:crabsin.spacen3tcat

Hello! I'm new to cross-compiling on NixOS. I want to compile C code for my custom M68k computer.

This is what my flake.nix file currently looks like:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils?ref=main";
  };

  outputs =
    inputs:
    inputs.flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = inputs.nixpkgs.legacyPackages.${system};
      in
        {
          devShells.default = pkgs.mkShell {
            packages = (
              with pkgs; [
                minipro
                gnumake
                pkgsCross.m68k.buildPackages.gcc
                xxd
              ]
            );
          };
        }
    );
}

I think I want to remove the pkgsCross.m68k line and add in crossSystem pointing at this patch from K900: https://github.com/K900/nixpkgs/commit/e8d4e76093cd396805e76c908734a351cc6d1f39
But I'm not really clear on what I'm actually doing (plus I want my other packages to not be cross-compiled as I want to run them on my x86 box)

19:04:42
@k900:0upti.meK900Easiest is probably to just cherry-pick that patch into your own nixpkgs fork19:06:20
@k900:0upti.meK900And then it should work19:06:25
@k900:0upti.meK900I think19:06:26
@stephen:crabsin.spacen3tcatI guess I don't really know what needs to go in the flake.nix file to start, even if I point it at my custom nixpkgs repo19:06:49
@k900:0upti.meK900Oh19:07:00
@stephen:crabsin.spacen3tcatLike so that I have access to an m68k cross compiler for my C code19:07:02
@k900:0upti.meK900We don't have an m68k-unknown-elf platform do we19:07:08
@k900:0upti.meK900 Then something like

let pkgsCrossM68k = import inputs.nixpkgs { system = "x86_64-linux"; cross-system = "m68k-unknown-none-elf"; }; in pkgs.mkShell { ... packages = [ pkgsCrossM68k.stdenv.cc ]; }
19:08:12
@stephen:crabsin.spacen3tcatahh I see19:08:38
@stephen:crabsin.spacen3tcatthank you this is super helpful19:08:43
@stephen:crabsin.spacen3tcat Should that override cc? cc -march=68000 mandelbrot.c says the arch isn't supported. I'm not seeing anything under m68k-* either 19:13:57
@k900:0upti.meK900Uhh19:19:46
@k900:0upti.meK900Can you post the whole thing19:19:48
@k900:0upti.meK900It should be prefixed19:19:56
@stephen:crabsin.spacen3tcat
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils?ref=main";
  };

  outputs =
    inputs:
    inputs.flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = inputs.nixpkgs.legacyPackages.${system};
        pkgsCrossM68k = import "/home/stephen/src/k900/nixpkgs" {
          system = "x86_64-linux"; cross-system = "m68k-unknown-none-elf";
        };
      in
        {
          devShells.default = pkgs.mkShell {
            packages = (
              with pkgs; [
                minipro
                gnumake
                xxd

                pkgsCrossM68k.stdenv.cc
              ]
            );
          };
        }
    );
}

I'm doing nix develop --impure for now. I'll fix the path once things are good

19:20:59
@k900:0upti.meK900 It's crossSystem 19:22:02
@k900:0upti.meK900And yes it takes arbitrary args don't ask19:22:09
@stephen:crabsin.spacen3tcatwell it's hanging and my cpu is at 100% so it's probably building19:26:57
@stephen:crabsin.spacen3tcatyippee this is cool19:27:05

Show newer messages


Back to Room ListRoom Version: 6