{"id":15883064,"url":"https://github.com/plmercereau/nixos-pi-zero-2","last_synced_at":"2025-07-10T16:38:58.571Z","repository":{"id":205808748,"uuid":"715139428","full_name":"plmercereau/nixos-pi-zero-2","owner":"plmercereau","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-21T06:50:39.000Z","size":11,"stargazers_count":67,"open_issues_count":4,"forks_count":19,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-21T07:34:44.359Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plmercereau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-11-06T14:56:57.000Z","updated_at":"2025-06-21T06:50:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"4d4b9525-2f33-4454-a9c6-d40ce17b085a","html_url":"https://github.com/plmercereau/nixos-pi-zero-2","commit_stats":null,"previous_names":["plmercereau/nixos-pi-zero-2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/plmercereau/nixos-pi-zero-2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fnixos-pi-zero-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fnixos-pi-zero-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fnixos-pi-zero-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fnixos-pi-zero-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plmercereau","download_url":"https://codeload.github.com/plmercereau/nixos-pi-zero-2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plmercereau%2Fnixos-pi-zero-2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264608262,"owners_count":23636695,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T04:08:24.385Z","updated_at":"2025-07-10T16:38:58.550Z","avatar_url":"https://github.com/plmercereau.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Building a NixOS SD image for a Raspberry Pi Zero 2 w\n\n1. Update `zero2w.nix`\n\nIn particular, don't forget:\n- to configure your wifi\n- to add an admin user able to connect through ssh\n\n2. Build the image\n```sh\nnix build -L .#nixosConfigurations.zero2w.config.system.build.sdImage\n```\n\n3. Copy the image in your sd card\n\n```sh\nDEVICE=/dev/disk5 # Whatever your sd card reader is\nsudo dd if=result/sd-image/zero2.img of=$DEVICE bs=1M conv=fsync status=progress\n```\n\n4. Boot your Zero\n5. Get your IP\n\n```sh\nifconfig wlan0\n```\n\n6. From another machine, rebuild the system:\n```sh\nZERO2_IP=\u003cthe-zero2-ip\u003e\nSSH_USER=\u003cthe-admin-user-in-the-pi\u003e\nnix run github:serokell/deploy-rs .#zero2w -- --ssh-user $SSH_USER --hostname $ZERO2_IP\n```\n\n## Notes\n\n- 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`.\n  - 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.\n- I still couldn't find a way to use `boot.kernelPackages = pkgs.linuxKernel.packages.linux_rpi3`. \n- the `sdImage.extraFirmwareConfig` option is not ideal as it cannot update `config.txt` after it is created in the sd image.\n- An overlay in the `hardware.deviceTree` has activated the i2c bus. This means that the `i2c-tools` are now working!\n\n## See also\n- [this issue](https://github.com/NixOS/nixpkgs/issues/216886)\n- [this gist](https://gist.github.com/plmercereau/0c8e6ed376dc77617a7231af319e3d29)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplmercereau%2Fnixos-pi-zero-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplmercereau%2Fnixos-pi-zero-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplmercereau%2Fnixos-pi-zero-2/lists"}