Skip to content

Sometimes build nix-manual when cross compiling (backport #13557)#13559

Merged
xokdvium merged 1 commit into2.28-maintenancefrom
mergify/bp/2.28-maintenance/pr-13557
Jul 26, 2025
Merged

Sometimes build nix-manual when cross compiling (backport #13557)#13559
xokdvium merged 1 commit into2.28-maintenancefrom
mergify/bp/2.28-maintenance/pr-13557

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jul 26, 2025

Motivation

At the moment, the nix-manual Meson subproject won’t be built if you’re cross compiling. This pull request makes it so that the nix-manual Meson subproject will be built if you’re cross compiling Nix and the build system is capable of executing host system binaries. (See the commit message for additional details).

Context

The main motivation behind this change is to deal with this Nixpkgs issue. Building pkgs.nixStatic counts as cross compiling Nix, and pkgs.nixStatic is supposed to produce a man output. Building pkgs.nixStatic currently fails because it isn’t actually producing a man output. That issue will go away once this pull request gets backported to Nix 2.28.x.

You can verify that this pull request fixes that Nixpkgs issue by doing the following:

  1. Create a file named nix-static.nix that contains this Nix expression:

    # This file is dedicated to the public domain using 🅭🄍1.0:
    # <https://creativecommons.org/publicdomain/zero/1.0>.
    let
      nixpkgsCommit = "17f6bd177404d6d43017595c5264756764444ab8";
      nixpkgsTarball = builtins.fetchTarball {
        url = "https://github.com/NixOS/nixpkgs/archive/${nixpkgsCommit}.tar.gz";
        sha256 = "1nwqbj0bmhdqf34d0y6qbpnwqa9bkhlqd03ffv60yami7fppnyb6";
      };
      pkgs = import nixpkgsTarball { };
    in
    {
      upstreamVersion = pkgs.nixStatic;
      versionFromThisPR = pkgs.nixStatic.overrideAttrs (
        finalAttrs: previousAttrs: {
          src = pkgs.fetchFromGitHub {
            owner = "Jayman2000";
            repo = "nix-pr";
            rev = "5e407e6abb5738f72b8b5aeeaa003728fe584c2f";
            hash = "sha256-s9lK09RpKklka/xDwPhmmUge19oR/zYp9lfuJkb+XHo=";
          };
        }
      );
    }
  2. Build that expression by running this command:

    nix-build --keep-going <path to nix-static.nix>
  3. Make sure that the build fails with exactly one error. The upstreamVersion attribute should fail to build with an error about the builder not creating a man output. The versionFromThisPR attribute should build successfully.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.


This is an automatic backport of pull request #13557 done by [Mergify](https://mergify.com).

Before this change, if you were cross compiling Nix, then the nix-manual
subproject would never get built. In some situations, it makes sense to
not build the nix-manual subproject when cross compiling. For example,
if the build system is x86_64 and the host system is riscv64, then it
makes sense to not build the manual. Building the manual requires
executing certain build artifacts, and you can’t run x86_64 executables
on riscv64 systems.

That being said, there are some situations where it does make sense to
build the nix-manual subproject when cross compiling. For example, if
the build system is x86_64 and the host system is i686, then it doesn’t
make sense to not build the manual. You can run i686 executables on
x86_64 systems just fine.

This change makes it so that the nix-manual subproject will sometimes
get built when cross compiling. Specifically, the nix-manual subproject
will get built as long as the doc-gen option is enabled and the build
system is capable of running host binaries.

---

The main motivation behind this change is to fix this Nixpkgs issue [1].
Building pkgs.nixStatic counts as cross compiling Nix, and
pkgs.nixStatic is supposed to produce a man output. Building
pkgs.nixStatic currently fails because it isn’t actually producing a man
output. That issue will go away once this commit gets backported to Nix
2.28.x.

[1]: <NixOS/nixpkgs#426410>

(cherry picked from commit 5e407e6)
@mergify mergify bot requested a review from edolstra as a code owner July 26, 2025 22:29
@mergify mergify bot added automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue labels Jul 26, 2025
@xokdvium xokdvium enabled auto-merge July 26, 2025 22:30
@xokdvium xokdvium merged commit 6c0cc04 into 2.28-maintenance Jul 26, 2025
25 checks passed
@xokdvium xokdvium deleted the mergify/bp/2.28-maintenance/pr-13557 branch July 26, 2025 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automatic backport This PR is a backport produced by automation (does not trigger backporting) merge-queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants