Skip to content

Fix NixOS cross-compilation SD Image#108173

Merged
flokli merged 1 commit intoNixOS:staging-nextfrom
flokli:cross-compile-nixos-sd
Jan 2, 2021
Merged

Fix NixOS cross-compilation SD Image#108173
flokli merged 1 commit intoNixOS:staging-nextfrom
flokli:cross-compile-nixos-sd

Conversation

@flokli
Copy link
Member

@flokli flokli commented Jan 1, 2021

Fixes #106759.

Motivation for this change

Build NixOS aarch64 sd image by just instantiating the profile, without any required manual hacks in the config.

Apparently, there was very few left to fix #106759 (for aarch64 at least).

polkit can be built without gobject introspection.

With this, I can just

nix-build -E 'let pkgs = (import ./.) {}; in (pkgs.pkgsCross.aarch64-multiplatform.nixos ./nixos/modules/installer/cd-dvd/sd-image-aarch64.nix).sdImage'

… computer go brrr…

And tada, you get a aarch64 image :-)

No more need to manually disable polkit and udisks.

fsck.fat 4.1 (2017-01-24)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkfs.fat"
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
      2048 bytes per cluster
         4 reserved sectors
First FAT starts at byte 2048 (sector 4)
         2 FATs, 16 bit entries
     30720 bytes per FAT (= 60 sectors)
Root directory starts at byte 63488 (sector 124)
       512 root directory entries
Data area starts at byte 79872 (sector 156)
     15321 data clusters (31377408 bytes)
32 sectors/track, 64 heads
         0 hidden sectors
     61440 sectors total
Checking for unused clusters.
firmware_part.img: 23 files, 11322/15321 clusters
61440+0 records in
61440+0 records out
31457280 bytes (31 MB, 30 MiB) copied, 0.100648 s, 313 MB/s
/nix/store/qg78laagrq3kp5fp0c9107ckapz0fxkw-nixos-sd-image-21.03pre-git-aarch64-linux.img-aarch64-unknown-linux-gnu/sd-image/nixos-sd-image-21.03pre-git-aarch64-linux.img : 25.91%   (4141109248 => 1073112729 bytes, /nix/store/qg78laagrq3kp5fp0c9107ckapz0fxkw-nixos-sd-image-21.03pre-git-aarch64-linux.img-aarch64-unknown-linux-gnu/sd-image/nixos-sd-image-21.03pre-git-aarch64-linux.img.zst)
/nix/store/qg78laagrq3kp5fp0c9107ckapz0fxkw-nixos-sd-image-21.03pre-git-aarch64-linux.img-aarch64-unknown-linux-gnu
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

gobject-introspection doesn't currently cross-compile (see
NixOS#88222), but polkit is somewhat
essential for many system components.

By disabling gobject-introspection when cross-compiling, we get it to
build.
@flokli flokli added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Jan 1, 2021
@flokli flokli requested review from grahamc, jtojnar and samueldr January 1, 2021 22:16
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jan 1, 2021
Copy link
Member

@Atemu Atemu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test on armv7l but this is a trivial change and should remove the gobject-introspection dependency from the base image.

Probably doesn't even need to go to staging-next, this causes 0 rebuilds on non-cross platforms.

@flokli
Copy link
Member Author

flokli commented Jan 2, 2021

I assumed staging-next to get merged soon anyways, and only did test on that branch.

IIRC, there was more in there necessary to build the full base image.

@flokli flokli merged commit 6221782 into NixOS:staging-next Jan 2, 2021
@FRidh
Copy link
Member

FRidh commented Jan 2, 2021

I assumed staging-next to get merged soon anyways, and only did test on that branch.

Hopefully in a day or two. Waiting for some aarch64 results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants