Hey! I am the author of the story you used to create the SD image. Glad that it went smoothly for you!
You’re using a Pi 3 which is actually the easiest model to get going with NixOS. You don’t need all of that cruft in your /etc/nixos/configuration.nix
, especially everything related to the firmware partition!
On the repo associated with my article there is an example configuration for the Pi 3 which should work out of the box. Here is it for visibility:
# Please read the comments!
{ config, pkgs, lib, ... }:
{
# Boot
boot.loader.grub.enable = false;
boot.loader.raspberryPi.enable = true;
boot.loader.raspberryPi.version = 3;
boot.loader.raspberryPi.uboot.enable = true;
# Kernel configuration
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelParams = ["cma=32M"];
# Enable additional firmware (such as Wi-Fi drivers).
hardware.enableRedistributableFirmware = true;
# Filesystems
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
};
swapDevices = [ { device = "/swapfile"; size = 1024; } ];
# Networking (see official manual or `/config/sd-image.nix` in this repo for other options)
networking.hostName = "nixpi"; # unleash your creativity!
# Packages
environment.systemPackages = with pkgs; [
# customize as needed!
vim git htop
];
# Users
# === IMPORTANT ===
# Change `yourName` here with the name you'd like for your user!
users.users.yourName = {
isNormalUser = true;
# Don't forget to change the home directory too.
home = "/home/yourName";
# This allows this user to use `sudo`.
extraGroups = [ "wheel" ];
# SSH authorized keys for this user.
openssh.authorizedKeys.keys = [ "ssh-ed25519 ..." ];
};
# Miscellaneous
time.timeZone = "Europe/Rome"; # you probably want to change this -- otherwise, ciao!
services.openssh.enable = true;
# WARNING: if you remove this, then you need to assign a password to your user, otherwise
# `sudo` won't work. You can do that either by using `passwd` after the first rebuild or
# by setting an hashed password in the `users.users.yourName` block as `initialHashedPassword`.
security.sudo.wheelNeedsPassword = false;
# Nix
nix.gc.automatic = true;
nix.gc.options = "--delete-older-than 30d";
boot.cleanTmpDir = true;
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "20.03";
}
After putting this in /etc/nixos/configuration.nix
, a simple nixos-rebuild switch
should do.
There is no need to import any hardware configuration or any other file with this. It can also be quite easily modularized in multiple files!
Hopefully this helps!
Roberto