Skip to content

Commit 28c2fff

Browse files
committed
rpi4.nix
1 parent a357f41 commit 28c2fff

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

nix/rpi4.nix

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#
2+
# NOTE : Install with the command:
3+
#
4+
# curl -L https://raw.githubusercontent.com/functora/functora.github.io/refs/heads/master/nix/rpi4.nix > /etc/nixos/configuration.nix
5+
#
6+
# NOTE : There is HDMI/wifi interference issue on rpi4. If wifi is not working, set lower resolution:
7+
#
8+
# - Mount boot partition.
9+
# - Add hdmi_safe=1 line to config.txt.
10+
# - Reboot.
11+
#
12+
{
13+
config,
14+
pkgs,
15+
lib,
16+
...
17+
}: let
18+
user = "TODO";
19+
password = "TODO";
20+
SSID = "TODO";
21+
SSIDpassword = "TODO";
22+
hostname = "TODO";
23+
in {
24+
boot = {
25+
kernelPackages = pkgs.linuxKernel.packages.linux_rpi4;
26+
initrd.availableKernelModules = ["xhci_pci" "usbhid" "usb_storage"];
27+
loader = {
28+
grub.enable = false;
29+
generic-extlinux-compatible.enable = true;
30+
};
31+
};
32+
33+
fileSystems = {
34+
"/" = {
35+
device = "/dev/disk/by-label/NIXOS_SD";
36+
fsType = "ext4";
37+
options = ["noatime"];
38+
};
39+
};
40+
41+
networking = {
42+
hostName = hostname;
43+
wireless = {
44+
enable = true;
45+
networks."${SSID}".psk = SSIDpassword;
46+
interfaces = ["wlan0"];
47+
};
48+
};
49+
50+
users = {
51+
mutableUsers = false;
52+
users."${user}" = {
53+
isNormalUser = true;
54+
password = password;
55+
extraGroups = ["wheel"];
56+
};
57+
};
58+
59+
hardware.enableRedistributableFirmware = true;
60+
system.stateVersion = "23.11";
61+
62+
#
63+
# Apps
64+
#
65+
environment.systemPackages = with pkgs; [
66+
git
67+
vim
68+
htop
69+
cpuid
70+
udiskie
71+
litecli
72+
libraspberrypi
73+
];
74+
#
75+
# Storage
76+
#
77+
boot.tmp.cleanOnBoot = true;
78+
nix.settings.auto-optimise-store = true;
79+
services.journald.extraConfig = ''
80+
SystemMaxUse=100M
81+
MaxFileSec=7day
82+
'';
83+
#
84+
# Automount
85+
#
86+
services.gvfs.enable = true;
87+
services.udisks2.enable = true;
88+
#
89+
# Networking
90+
#
91+
networking.firewall.enable = true;
92+
services.fail2ban.enable = true;
93+
services.openssh = {
94+
enable = true;
95+
settings.PasswordAuthentication = false;
96+
settings.KbdInteractiveAuthentication = false;
97+
settings.PermitRootLogin = "no";
98+
};
99+
}

0 commit comments

Comments
 (0)