Skip to content

Instantly share code, notes, and snippets.

@anned20
Created March 26, 2021 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anned20/2ef3e7488805eaf2403aa6b3b409908d to your computer and use it in GitHub Desktop.
Save anned20/2ef3e7488805eaf2403aa6b3b409908d to your computer and use it in GitHub Desktop.
My Rasbperry Pi configuration.nix
{ config, pkgs, lib, ... }:
{
# Disable GRUB
boot.loader.grub.enable = false;
# Enable Raspberry PI bootloader
boot.loader.raspberryPi.enable = true;
boot.loader.raspberryPi.version = 3;
boot.loader.raspberryPi.uboot.enable = true;
# Linux kernel
boot.kernelPackages = pkgs.linuxPackages_5_4;
# File systems
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
};
swapDevices = [ { device = "/swapfile"; size = 1024; } ];
hardware.enableRedistributableFirmware = true;
environment.systemPackages = with pkgs; [
vim
raspberrypi-tools
starship
git
];
programs.fish.enable = true;
services.openssh = {
enable = true;
permitRootLogin = "yes";
};
services.avahi = {
enable = true;
publish = {
enable = true;
addresses = true;
workstation = true;
};
};
networking = {
hostName = "raspberry-nix";
wireless.enable = true;
wireless.interfaces = [ "wlan0" ];
wireless.networks."My SSID".psk = (lib.fileContents "/secret/my-ssid-password");
nameservers = [ "1.1.1.1" "8.8.8.8" ];
enableIPv6 = false;
extraHosts = ''
127.0.0.1 raspberry-nix.local
'';
# Firewall
firewall.allowedTCPPorts = [ 22 80 ];
};
users.mutableUsers = false;
users.users.root.openssh.authorizedKeys.keys = [ "My SSH public key" ];
users.users.username = {
isNormalUser = true;
uid = 1000;
extraGroups = ["wheel"];
openssh.authorizedKeys.keys = [ "My SSH public key" ];
};
users.defaultUserShell = pkgs.fish;
imports = [
./services/mariadb.nix
./services/gitea.nix
./services/caddy.nix
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment