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

Add ootb RPi SD "support" #73

Closed
wants to merge 6 commits into from

Conversation

blaggacao
Copy link
Contributor

Example of #72 — since this is potentially out of scope for nixflk, I'm leaving it as draft for others to discover how I solved it. Maybe some aspets can inform nixflk, though (like renaming niximg to nixISO, or such).

@blaggacao
Copy link
Contributor Author

blaggacao commented Jan 11, 2021

latest kernel support got merged in master, so the patch + overlay is soon no more necesary

David Arnold added 3 commits January 11, 2021 18:44
Don't use sdcard module from master due to modules and pkg
incopmatibilities
@blaggacao
Copy link
Contributor Author

Ok, so:

$ nix develop
$ flk sd

fails with (what the heck?)

/nix/store/fy819ys8fyzm02bjvzfvr7qiihr4allh-flk-env/bin/nix: line 2: 104701 Segmentation fault      (core dumped) /nix/store/6b7s5f2vrlixmlyr9bi1gkrgkq6xqgmw-nix-2.4pre20201205_a5d85d0/bin/nix --option experimental-features "nix-command flakes ca-references" "$@"

But on a similar structured repo, it fails with:

Package ‘raspberrypi-firmware-1.20200601’ in /nix/store/vc3v85pjs6v04wn5w03z1b0mkl6r0p5q-source/pkgs/os-specific/linux/firmware/raspberrypi/default.nix:20 is not supported on ‘x86_64-linux’, refusing to evaluate.

a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.

(use '--show-trace' to show detailed location information)

I'm concluding that cross compilation is not supported to date in nixflk.

@nrdxp
Copy link
Collaborator

nrdxp commented Jan 12, 2021

I haven't messed with cross compilation in general in nix. So while I wouldn't mind including support for it in nixflk, we'd need someone more experience to implement it.

@blaggacao blaggacao mentioned this pull request Jan 12, 2021
@mohe2015
Copy link

mohe2015 commented Jan 23, 2021

EDIT: Sorry this doesn't cross compile, it uses qemu emulation which may not be what you want.

@blaggacao The radical but easiest way would likely to be: https://gist.github.com/mohe2015/3baaf764264f7bb9630bbe18dbdb6d8b/revisions (sorry for the not perfect diff, I just used my local version). This changes the build path to e.g. build with nix build .#nixosConfigurations.aarch64-linux.nixSD.config.system.build.toplevel. This doesn't really cross-compile but uses qemu binfmt emulation but I don't think this is even possible otherwise.

Edit: You then can't use the normal nixos-rebulid because it searches for the wrong path. No liability for any damages because I don't know myself what I'm doing but:

sudo nix build --profile /nix/var/nix/profiles/system .#nixosConfigurations.x86_64-linux.NixOS.config.system.build.toplevel
sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch

should work.

nix build .#nixosConfigurations.aarch64-linux.nixSD.config.system.build.sdImage

should build the aarch64 image.

To get the old way to work again a merge of both methods would probably be necessary.

@nrdxp
Copy link
Collaborator

nrdxp commented Feb 4, 2021

This seems to be supplanted by your #105, can I close?

@blaggacao blaggacao closed this Feb 4, 2021
@blaggacao blaggacao deleted the da-explore-nixSD branch February 4, 2021 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants