raspberry-pi-nix
raspberry-pi-nix copied to clipboard
Configuration does not persist across reboots
I'm not sure if this is actually just user error, but the process I attempted was:
- Build an SD image using an installation of Nix under Raspberry Pi OS on a different SD card
- Write the image to the target SD card and boot from it
- Log in as
rootand notice there's nothing in/etc/nixos/so I run nixos-generate-config - The generated config has GRUB enabled for some reason
nixos-rebuild switchfails because flakes aren't enabled (???)- Enable flakes in
root's per-user nix.conf - A different error about not finding nixos-config
nixos-rebuild -I nixos-config=/etc/nixos/configuration.nix switch- After rebooting the configuration does not persist This is on a Raspberry Pi 5
Hi, this does sound like a user error.
It sounds like you generated a default config in (3) that does not import raspberry-pi-nix, then switched. If that's correct, then a failure is expected.
This project supports and uses the default raspberry pi boot process, so you will need to switch to configurations that handle that appropriately. This project does handle that appropriately, so importing it remains important after the initial sd card image is written.
Some of what you mentioned is related to https://github.com/nix-community/raspberry-pi-nix/discussions/32, so you may find that discussion interesting.
how do I import raspberry-pi-nix in this case?
what does a working configuration.nix look like?
The readme links the example repo https://github.com/tstat/raspberry-pi-nix-example/tree/master.
so I just have to use a flake.nix?
I haven't tried to use this flake in a while, but an update: after booting the built system, I put an adapted version of the example config in the README in /etc/nixos/flake.nix and ran nixos-rebuild switch, and it tried to rebuild everything again. Including the kernel. I couldn't get it to not do that after multiple attempts, so I gave up.
Did you include the flake.lock file from this repo? Otherwise the rebuild will build against the then-current version of nixpkgs, which will be different from the one this repo is locked to.