Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

nixos-rebuild --target-host will inherit system from invocation and not target host (flake) #134952

Copy link
Copy link
@pyle

Description

@pyle
Issue body actions

Describe the bug

x86_64 packages are built and attempted to be installed when targeting an aarch64-linux machine.

Example:
nixos-rebuild build --target-host r2 --flake .#r2
Error:

error: a 'x86_64-linux' with features {} is required to build '/nix/store/b1kxbl7araqsqhfbd5m77vf41kiab6gh-append-initrd-secrets.drv', but I am a 'aarch64-linux' with features {benchmark, big-parallel, gccarch-armv8-a, kvm, nixos-test}

I'm new to NixOS, but im guessing that because we're grabbing architecture from the local system this is why this behaviour is happening?

ex. nixSystem() is defined via local invocation of uname -a and then used a few lines later when defining nixStorePath

Steps To Reproduce

Steps to reproduce the behavior:

  1. Have nixosConfiguration that can be built on aarch64 e.g. I've copied this flake to the device and can run nixos-rebuild switch --flake '.#' without any issue regarding architecture.
  2. nixos-rebuild build --target-host <my_aarch64_target_host> --flake .#targetHostNameThatIsAarch64
  3. Observe error about the packages requiring x86 but being aarch64 (above).

Expected behavior

nixos-rebuild builds/switches using the correct architecture of the target-host.

Additional context

From what I can work out we can't pass args like --argstr system aarch64-linux to nixos-rebuild as we're likely assuming same architecture.

Notify maintainers

@chvp

Metadata

Machine invoking nixos-rebuild --target-host

 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.48, NixOS, 21.05.20210710.9376bf7 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre20210601_5985b8b`
 - channels(pyle): `""`
 - channels(root): `"nixos-21.05.2362.b09c989b82f"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos

--target-host in question

 - system: `"aarch64-linux"`
 - host os: `Linux 5.10.48, NixOS, 21.05.20210710.9376bf7 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.4pre20210601_5985b8b`
 - channels(root): `"nixos-21.05.2501.94c989365d5"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module: nixos-rebuild

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is brokenSomething is broken6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOSIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.