Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/plmercereau/nixos-pi-zero-2
https://github.com/plmercereau/nixos-pi-zero-2
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/plmercereau/nixos-pi-zero-2
- Owner: plmercereau
- Created: 2023-11-06T14:56:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-17T09:53:10.000Z (22 days ago)
- Last Synced: 2024-10-23T09:38:59.634Z (16 days ago)
- Language: Nix
- Size: 5.86 KB
- Stars: 38
- Watchers: 5
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Building a NixOS SD image for a Raspberry Pi Zero 2 w
1. Update `zero2w.nix`
In particular, don't forget:
- to configure your wifi
- to add an admin user able to connect through ssh2. Build the image
```sh
nix build -L .#nixosConfigurations.zero2w.config.system.build.sdImage
```3. Copy the image in your sd card
```sh
DEVICE=/dev/disk5 # Whatever your sd card reader is
sudo dd if=result/sd-image/zero2.img of=$DEVICE bs=1M conv=fsync status=progress
```4. Boot your Zero
5. Get your IP```sh
ifconfig wlan0
```6. From another machine, rebuild the system:
```sh
ZERO2_IP=
SSH_USER=
nix run github:serokell/deploy-rs .#zero2w -- --ssh-user $SSH_USER --hostname $ZERO2_IP
```## Notes
- The Zero 2 doesn't have enough RAM to build itself. An initial lead was to create a swap partition, but it turns out it was a bad idea, as it would have decreased the sd card lifetime (sd cards don't like many write operations). A `zram` swap is not big enough to work. Hence the use of `deploy-rs`.
- Note that `nixos-rebuild --target-host` would work instead of using `deploy-rs`. but as `nixos-rebuild` is not available on Darwin, I'm using `deploy-rs` that works both on NixOS and Darwin.
- I still couldn't find a way to use `boot.kernelPackages = pkgs.linuxKernel.packages.linux_rpi3`.
- the `sdImage.extraFirmwareConfig` option is not ideal as it cannot update `config.txt` after it is created in the sd image.## See also
- [this issue](https://github.com/NixOS/nixpkgs/issues/216886)
- [this gist](https://gist.github.com/plmercereau/0c8e6ed376dc77617a7231af319e3d29)