Add raspi config

This commit is contained in:
Cyryl Płotnicki 2021-12-04 21:47:27 +00:00
parent 39f0cfe600
commit 93081947ad
3 changed files with 69 additions and 1 deletions

View file

@ -13,6 +13,14 @@
];
specialArgs = { inherit inputs; };
};
mkRaspi = pkgs: hostname:
pkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
(./. + "/nixos/boxes/${hostname}")
];
specialArgs = { inherit inputs; };
};
mkWorkstation = pkgs: system: hostname:
pkgs.lib.nixosSystem {
system = system;
@ -43,6 +51,7 @@
thinky = mkWorkstation nixpkgs-stable "x86_64-linux" "thinky";
bolty = mkServer nixpkgs-stable "x86_64-linux" "bolty";
vultr1 = mkServer nixpkgs-stable "x86_64-linux" "vultr1";
rpi4_8 = mkRaspi nixpkgs-stable "rpi4-8";
bootstrap = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
@ -56,7 +65,7 @@
raspiimage = nixpkgs-stable.lib.nixosSystem {
system = "aarch64-linux";
modules = [
(import "${inputs.nixpkgs-stable}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix")
(import "${inputs.nixpkgs-nixos-unstable}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix")
{
services.openssh = {
enable = true;
@ -67,6 +76,7 @@
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE5Ejx5CAPUfHVXi4GL4WmnZaG8eiiOmsW/a0o1bs1GF cyryl@foureighty"
];
sdImage.compressImage = false;
console.earlySetup = true;
}
];
specialArgs = { inherit inputs; };

View file

@ -0,0 +1,57 @@
{ config, pkgs, inputs, lib, ... }:
{
imports = [
];
boot = {
kernelPackages = pkgs.linuxPackages_rpi4;
tmpOnTmpfs = true;
initrd.availableKernelModules = [ "usbhid" "usb_storage" ];
kernelParams = [
"8250.nr_uarts=1"
"console=ttyAMA0,115200"
"console=tty1"
# Some gui programs need this
"cma=128M"
];
};
boot.loader.raspberryPi = {
enable = true;
version = 4;
};
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
networking = {
hostName = "rpi4-8";
networkmanager = {
enable = true;
};
};
environment.systemPackages = with pkgs; [ neovim htop ];
services.fail2ban.enable = true;
services.openssh = {
enable = true;
permitRootLogin = "prohibit-password";
passwordAuthentication = false;
};
users.extraUsers.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE5Ejx5CAPUfHVXi4GL4WmnZaG8eiiOmsW/a0o1bs1GF cyryl@foureighty"
];
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
security.allowUserNamespaces = true;
time.timeZone = "Europe/London";
}

View file

@ -29,6 +29,7 @@
kopia
lm_sensors
mercurial
minicom
nix-index
nix-top
nixpkgs-fmt