-
Notifications
You must be signed in to change notification settings - Fork 7
/
zero2w.nix
102 lines (87 loc) · 2.64 KB
/
zero2w.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
lib,
modulesPath,
pkgs,
...
}: {
imports = [
./sd-image.nix
];
# Some packages (ahci fail... this bypasses that) https://discourse.nixos.org/t/does-pkgs-linuxpackages-rpi3-build-all-required-kernel-modules/42509
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x:
super.makeModulesClosure (x // { allowMissing = true; });
})
];
nixpkgs.hostPlatform = "aarch64-linux";
# ! Need a trusted user for deploy-rs.
nix.settings.trusted-users = ["@wheel"];
system.stateVersion = "24.05";
zramSwap = {
enable = true;
algorithm = "zstd";
};
sdImage = {
# bzip2 compression takes loads of time with emulation, skip it. Enable this if you're low on space.
compressImage = false;
imageName = "zero2.img";
extraFirmwareConfig = {
# Give up VRAM for more Free System Memory
# - Disable camera which automatically reserves 128MB VRAM
start_x = 0;
# - Reduce allocation of VRAM to 16MB minimum for non-rotated (32MB for rotated)
gpu_mem = 16;
# Configure display to 800x600 so it fits on most screens
# * See: https://elinux.org/RPi_Configuration
hdmi_group = 2;
hdmi_mode = 8;
};
};
# Keep this to make sure wifi works
hardware.enableRedistributableFirmware = lib.mkForce false;
hardware.firmware = [pkgs.raspberrypiWirelessFirmware];
boot = {
kernelPackages = pkgs.linuxPackages_rpi02w;
initrd.availableKernelModules = ["xhci_pci" "usbhid" "usb_storage"];
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
# Avoids warning: mdadm: Neither MAILADDR nor PROGRAM has been set. This will cause the `mdmon` service to crash.
# See: https://github.com/NixOS/nixpkgs/issues/254807
swraid.enable = lib.mkForce false;
};
networking = {
interfaces."wlan0".useDHCP = true;
wireless = {
enable = true;
interfaces = ["wlan0"];
# ! Change the following to connect to your own network
networks = {
"<ssid>" = {
psk = "<ssid-key>";
};
};
};
};
# Enable OpenSSH out of the box.
services.sshd.enable = true;
# NTP time sync.
services.timesyncd.enable = true;
# ! Change the following configuration
users.users.bob = {
isNormalUser = true;
home = "/home/bob";
description = "Bob";
extraGroups = ["wheel" "networkmanager"];
# ! Be sure to put your own public key here
openssh.authorizedKeys.keys = ["a public key"];
};
security.sudo = {
enable = true;
wheelNeedsPassword = false;
};
# ! Be sure to change the autologinUser.
services.getty.autologinUser = "bob";
}