Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NixOS cross-compilation SD Image #108173

Merged
merged 1 commit into from Jan 2, 2021

Conversation

flokli
Copy link
Contributor

@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 sort platform than than they will be run on label 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
Contributor 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 sort platform than than they will be run on 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants