<apache8080>
I am trying to build a nix arm image following these directions: https://nixos.wiki/wiki/NixOS_on_ARM#Build_your_own_image and I setup `boot.binfmt.emulatedSystems = [ "aarch64-linux" ];` in my configuration.nix on NixOS but when I run `nix-build '<nixpkgs/nixos>' -A pkgs.theRequiredPackage --argstr system aarch64-linux -I
<apache8080>
nixos-config=/path/to/target/machine/nixos/config/copy` I get the following error `while setting up the build environment: executing '/nix/store/i4klj1csjdfvcljfvq0pq87f6mjimxav-bash-4.4-p23/bin/bash': Exec format error`
rajivr has quit [Quit: Connection closed for inactivity]
<patagonicus>
cript0nauta: I cross-compiled it, with a lot of help from this channel. :) I want to add instructions to the wiki, but wanted to make sure everything works.
<patagonicus>
I've also since rebuilt the image natively, since a) the commit of nixpkgs that worked with cross-compiling was from April and b) a cross-compiled system will have to recompile everything on the first nixos-rebuild and c) apparently the uboot behaves slightly different when cross-compiled.
<patagonicus>
If you want I can give you either the configs to build the image yourself or upload the image, though the I recently built has some customizations enabled.
<cript0nauta>
nice! sure, the configs would be really helpful!
<cript0nauta>
so does uboot work when cross-compiled, natively-compiled or in both cases?
<patagonicus>
It works in both, but cross-compiled it's loading the wrong device tree blob - or trying to. But you can just copy one file (or probably symlink, haven't tried).
<patagonicus>
The downside is that you have to do that every time you install a new kernel version, but you can just recompile and install u-boot on the hc2 itself, which doesn't take long. At least compared to rebuilding the base system (~12h or so).
t184256 has left #nixos-aarch64 ["Error from remote client"]
<patagonicus>
The annoying bit is that you'll have to manually install u-boot to the SD card. There's a script in the nix/store/*-odroid-xu3-bootloader/ dir on the sd image, but the script is using the armv7 bash and the paths are all for the sd card. But in the end it's only dd'ing four files at different offsets which isn't too hard to do manually.
<patagonicus>
As I said, I want to put that in the wiki eventually - maybe this weekend if I can figure out how to fix the SATA port on reboot.
<patagonicus>
Wow. Sometimes I can be a bit stupid. I saw the linux-hardkernel-4.14.nix in nixpkgs and thought it was a hardened kernel. I even remember thinking that it's really unfortunate naming as it sounds like it's the Hardkernel company. Well, turns out that file is for the kernel fork from Hardkernel …
<cript0nauta>
thanks for the files! I need to get some new SD cards and then I'll try it out
<cript0nauta>
i'm already running nix in the HC2 so at least I can forget about the cross-compilation part :)
<patagonicus>
Oh, right.
FRidh has joined #nixos-aarch64
<patagonicus>
The generated image also isn't perfect. It has a completely useless firmware partition, but sd-image.nix doesn't have a way of disabling it. I want to build something that generates an image with the right bootloader and only an ext4 / partition, but haven't gotten around to it.
<patagonicus>
But once the SATA problems are fixed (and I really hope using hardkernel's kernel does that) I'll order three more as I want to build a glusterfs setup. :)
<thefloweringash>
patagonicus: i just realised i have an 8 core armv7l board around. I'll try bash-completion on it
<patagonicus>
Oh, nice
orivej has quit [Ping timeout: 265 seconds]
<cript0nauta>
oops it sounds a bit unstable, but anyway, it's worth a try!
<cript0nauta>
running nixos inside LXC isn't exactly stable neither though
<patagonicus>
It's running fine other than the SATA thing - when rebooting the SATA port doesn't work anymore, you have to shutdown and replug power.
lopsided98 has quit [Quit: No Ping reply in 180 seconds.]
<lopsided98>
patagonicus: I run the hardkernel kernel on my XU4 and it gets stuck there on a warm reboot. Try removing power for ~15 seconds. It sometimes takes a couple of tries
bdju_ has joined #nixos-aarch64
bdju_ has quit [Client Quit]
bennofs has joined #nixos-aarch64
bennofs_ has quit [Ping timeout: 240 seconds]
orivej_ has quit [Ping timeout: 260 seconds]
orivej has joined #nixos-aarch64
FRidh has quit [Ping timeout: 240 seconds]
FRidh has joined #nixos-aarch64
AmandaC has quit [Remote host closed the connection]
cole-h has joined #nixos-aarch64
apache8080 has joined #nixos-aarch64
<apache8080>
So I built my own image for ARM following these instructions: https://nixos.wiki/wiki/NixOS_on_ARM#Build_your_own_image and was able to boot the SD card on to my raspberry pi. But when I run nixos-generate-config on the pi it creates a hardware config that says installer not detected. How do I get generate config to use my base generic images
<apache8080>
config so users don't screw up the pi setup when trying to add their own config for packages?
<Jake[m]1>
I'm not 100% positive, but I think don't worry about the installer not detected in the hardware config. I think you basically want to take the config you used to make the image and start from there.
<apache8080>
hmm ok, that seems like an annoying user experience
<apache8080>
is there a way to modify what nixos-generate-config generates?
<Jake[m]1>
<apache8080 "hmm ok, that seems like an annoy"> Haha yup, sometimes nix is like that.
<Jake[m]1>
<apache8080 "is there a way to modify what ni"> You can modify the hardware config if you want, but I actually think that's not a great idea. I inlined it in what I sent you, but I wouldn't recommend that and I'm undoing it soon. But you can modify configuration.nix as much as you want. I don't the not detected thing will cause and issue if you leave it in, if that's what you're asking. I'm not sure exactly what it
<Jake[m]1>
does to be honest.
<apache8080>
ok, I was wondering if I could get nixos-generate-config to basically just generate the config that was used to boot the device
<apache8080>
or if there is some other command
<apache8080>
also do you know where the currently used configuration.nix is when you boot the pi for the first time
<samueldr>
the configuration for the default image is at <nixpkgs/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix>
<samueldr>
that is what is running
<Jake[m]1>
I'm not sure the configuration.nix is store anywhere. If you built the image yourself, you should have it.
<samueldr>
there is no mechanism that can produce a configuration.nix from it that is useful in the end
<Jake[m]1>
^^ as in stored in the running system
<samueldr>
note that this configuration includes the installer profiles, which in turn do things that are not useful for an installed system, like forcing the nixos users, autologin, etc
Jonathan73 has joined #nixos-aarch64
<Jake[m]1>
Does it also contain some mechanism to create the partitions on the SD card, also which is not necessary for an installed system?
<samueldr>
yes and no
<samueldr>
it's a different "output"
<samueldr>
a nixos config, when evaluated, uses the "system.build.topLevel" "output" (iirc)
<samueldr>
while when you build the SD image you use -A config.system.build.sdImage
<samueldr>
so even though the configuration exists to produce partitions, it's not going to be evaluated and used with topLevel
<Jake[m]1>
Does that create the partitions based on the same "fileSystems" option used to mount, or is it specified elsewhere? Just curious.
<Jonathan73>
I want to install NixOS on my new PinePhone. I feel like I am missing a couple things from the explanations. I was hoping I could ask a couple questions.
<Jonathan73>
I am getting lost between the general instructions, and the device specific instructions.
<Jonathan73>
In the device specific instructions it tells me how to use `nix-build` to build the image. Does that need to be done on an aarch64 processor, as the general instructions seem to imply?
<samueldr>
for the full system (including rootfs) it might require native build
<samueldr>
for stage-1 image (kernel+initrd) it should be able to cross-compile, BUT Nixpkgs itself is having a hard time cross-compiling recently
<samueldr>
for the time being, 22a3bf9fb9edad917fb6cd1066d58b5e426ee975 is a known good revision of Nixpkgs
<samueldr>
you will get a seemingly not working image
<samueldr>
in fact, it has successfully booted a system without a GUI, without users, without any configuration
<samueldr>
this is what you would get if you nix-built in the root of the project
<Jonathan73>
So, I need to `dd` of the native built rootfs to the SD, then use that known revision of nixpkgs and `dd` it (with the special arguments) on top.
* samueldr
checks the device specific instructions
<samueldr>
kind of, but not exactly
<Jonathan73>
Okay, so the PinePhone specific stuff is a configuration using different patches/drivers/things for a more usable system.
<samueldr>
not even, they are instructions explaining how to do some specific things that you might not need :)
<samueldr>
the `build.disk-image` output already includes the boot partition and u-boot
<samueldr>
the two following instructions are for if you wanted to build a replacement boot partition or u-boot to develop / upgrade them
<samueldr>
I see and now know there are two critically missing piece of information here
<samueldr>
well, in the docs
<samueldr>
(1) how Mobile NixOS boots
<samueldr>
(2) (outside of the docs probably) a step by step guide on how to assemble an image using hydra outputs
FRidh has quit [Ping timeout: 246 seconds]
<Jonathan73>
Oh, I missed the existence of a Moble-NixOS docs!
<samueldr>
so I accidentally made it so the virtual console is not showing after stage-1
<Jonathan73>
I will definitely read (is is basically what you said in your talk at NixCon last year?).
<samueldr>
not at all, entirely new stuff
<Jonathan73>
Oo, definitely will read (:
<samueldr>
last nixcon I mostly dwelled on the past
<Jonathan73>
Yeah, true.
<samueldr>
and showed it can be done, and is being done :)
<samueldr>
so yeah, if you first `dd` a full disk image, and then `dd` that rootfs on top of the "useless" rootfs, it should get you the demo working
orivej has quit [Ping timeout: 240 seconds]
<samueldr>
and, you can either embiggen the 2nd partition using partition tools on your system, or just boot it and force shutdown, it's not like it matters if that "useless" rootfs end up corrupted
orivej has joined #nixos-aarch64
<Jonathan73>
Okay, I think I have pieced together whet you are saying.
<Jonathan73>
Download that first "useless" system, which is a boot partition and a dummy root; `dd` it.
<Jonathan73>
Boot it once to let it do its thing.
<Jonathan73>
Embiggen the root partition (the second partition).
<Jonathan73>
`dd` a new root of a known successful hydra build (the second link)
AmandaC has quit [Quit: Toodles]
<samueldr>
yes
<samueldr>
from there on you will have what I call the "demo" system, which is not representative of *all* you can do, but is only something I threw together for cheap for last NixCon :)
<samueldr>
it's basically XFCE with awesome running in a single window mode
<samueldr>
and some pre-configured things like bigger fonts
<samueldr>
I have made almost zero efforts yet on stage-2, the running system, because of that breadth-first development style :)
<Jonathan73>
Right, at that point though, it will be like a normal NixOS system which I can install/configure to my hearts content?
<samueldr>
yes
<samueldr>
though you cannot (as it is) use the different nixos bootloaders
<samueldr>
so don't configure any!
<Jonathan73>
Right, makes sense.
<Jonathan73>
So what is the part which the phone specific stuff? The rootfs or the kernal+init?
<Jonathan73>
Just the goofy drivers are device specific right? But those should be mainlined in the kernal?
<samueldr>
what I would do is (1) copy the examples/demo/ configuration (and files) [you can delete default.nix and android-burn-tool.nix] (2) edit as you need;
<samueldr>
for the pinephone, almost nothing, it's almost a joke, when you use this it's mostly to make it work like the other less flexible systems
<samueldr>
though you do get the graphical boot selection and boot UI for free
<samueldr>
everything is on its way to being mainlined by the devs downstream
<Jonathan73>
Right, okay. I guess I should read the device porting guide, I was just trying to understand what is the cause of not being able to run on any phone without problem.
<samueldr>
(1) is bootloaders/boot flow; most android devices directly boot a kernel, and don't allow installing something like grub
<Jonathan73>
Makes since (the primary thing amazing about the PinePhone!)
<samueldr>
(2) kernels; most android-based devices will only work fully with the downstream OEM kernel trees
AmandaC has joined #nixos-aarch64
<samueldr>
(3) "quirks"; the mobile nixos project aims to abstract away all the warts and nonsense of the devices so they all end up acting mostly the same for the end-user
<samueldr>
that (3) is the actually useful thing we want in the end :)
<samueldr>
if you look at the rootfs you downloaded
<samueldr>
it is generic!"
<samueldr>
the same rootfs boots on all (aarch64) devices!!
<Jonathan73>
Which is brilliant...that is how x86 computers work...
<samueldr>
back to the pinephone, Mobile NixOS is *one* way to get NixOS on the pinephone... nothing stops anyone from doing it "the hard way" (not that hard) and installing like on any allwinner board
<lopsided98>
I don't think we ever used mkfs.ext4 to populate the rootfs before. We switched to cptofs from a very hacky debugfs setup
<samueldr>
lopsided98: exactly
<c00w>
samueldr: Yeah, I think debugfs was a sketchy ext2 manipulator, looks like cptofs was more efficient, but since mkfs.ext4 has folder support, I'd love to use it (using mfgs.btrfs I shrunk my sd-image by like... 2G? and it's like 10s to build). Not sure how much faster mkfs.ext4 is, but I expect the answer is significantly.
cole-h has joined #nixos-aarch64
cole-h has quit [Client Quit]
<samueldr>
looking into that now
<samueldr>
my main concern, but a half-valid one, is if mkfs.ext4 -d is reproducible
<samueldr>
I say half-valid since we can still do that incremental upgrade
<samueldr>
but if it isn't, we should move to make_ext4fs
<c00w>
If you want I can go build it a few times to check :)
cole-h has joined #nixos-aarch64
<samueldr>
that's check the simplest cases (still useful
<samueldr>
ah, if mkfs.ext4 is not reproducible, but still an improvement, there is no good reason not to merge waiting for make_ext4fs, we can still switch to it later on
<samueldr>
I was curious as to whether `-d` was new or not... seems to have been introduced in 2014
cole-h has joined #nixos-aarch64
cole-h has quit [Client Quit]
<c00w>
samueldr:
<c00w>
sweet - any chance I can get you to say that in the PR?
<samueldr>
no
<samueldr>
because I intend to merge it after some more reading :)
cole-h has joined #nixos-aarch64
FRidh has quit [Quit: Konversation terminated!]
cole-h has quit [Quit: Goodbye]
zupo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<c00w>
samueldr: Thanks for listenening and potentially merging :)
<c00w>
samueldr++
<{^_^}>
samueldr's karma got increased to 245
<apache8080>
is it possible in my nixos configuration.nix to copy a file from disk and put it in /etc on a nixos-rebuild?
apache8080 has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 246 seconds]
<c00w>
yep
orivej has joined #nixos-aarch64
apache8080 has joined #nixos-aarch64
<apache8080>
is it possible in my nixos configuration.nix to copy a file from disk and put it in /etc on a nixos-rebuild?
<Jonathan73>
Whoopy, it is working, and it is awesome! ...and actually usable.
<samueldr>
at that point, you are likely to be at feature parity with whatever I have going, so for anything not working, my answer would be "not looked into it yet" :)
<Jonathan73>
Like the power button?
<Jonathan73>
lol
<samueldr>
the what now? :)
AmandaC has joined #nixos-aarch64
zupo has joined #nixos-aarch64
<samueldr>
oh, note that I have a defective device, I can't do USB at all (other than charging), so anything about USB is simply not something I can test :(
<{^_^}>
mobile-nixos#110 (by samueldr, 13 weeks ago, open): [WIP] Add "jumpdrive" example system
<samueldr>
(it may be stale and in need of fixes though)
<Jonathan73>
(The power button does not sleep the phone right now, but that is an XFCE thing)
<samueldr>
right
<samueldr>
though there are other issues
<samueldr>
suspend hasn't been looked into at all
<Jonathan73>
XD
<samueldr>
there is an alternative firmware for the thingy in the SoC that should be used now to get good suspend
<samueldr>
I *think* it's ready, or about to be
<samueldr>
"crust"
<samueldr>
it's able to suspend the device while keeping comms open IIRC
<Jonathan73>
O.o
<Jonathan73>
I can certainly test that pull, I'll just have to figure out how to do that (:
<samueldr>
at the time it was introduced, building, flashing to SD, would have been enough, it would have made the device's eMMC show up on the host USB device (the computer)
<samueldr>
oh, forgot an important bit: booting that system duh
<Jonathan73>
I have to build it on aarch64, yes? Or is it the boot partition?
<samueldr>
this system should be entirely cross-compiler friendly
<samueldr>
the demo rootfs just has too much going on :)
<Jonathan73>
It is more than just a change to the configuration file, and will require a rebuild. Not as simple as `nixos-rebuild` ):
<samueldr>
it's definitely not a nixos configuration thing :)
<samueldr>
no need to test it if you're not comfortable doing it, especially since anyways it's possibly not building right now
<Jonathan73>
What is the worst that can happen? I have to reformat my SD? You cannot brick a PinePhone (at least not like that). I'll figure it out sometime later though. Right now I am going to configure this thing (:
<samueldr>
nothing bad should happen, if you have another sd card around, no need to format your SD card
apache8080 has quit [Remote host closed the connection]
<Jonathan73>
Hey samueldr how do you have things installed on the demo build? `nix-env -q` shows nothing an `/etc/nixos/configuration.nix` is also empty?
orivej has quit [Ping timeout: 240 seconds]
<samueldr>
you don't have to have an /etc/nixos/configuration.nix to produce an image file, or even build a system!