{ lib, pkgs, modulesPath, ... }: { imports = [ (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") ]; boot = { kernelPackages = let version = "6.1.73"; tag = "stable_20240124"; srcHash = "sha256-P4ExzxWqZj+9FZr9U2tmh7rfs/3+iHEv0m74PCoXVuM="; in pkgs.linuxPackagesFor ( pkgs.linux_rpi4.override { argsOverride = { src = pkgs.fetchFromGitHub { owner = "raspberrypi"; repo = "linux"; rev = tag; hash = srcHash; }; version = version; modDirVersion = version; structuredExtraConfig = { }; kernelPatches = [ { name = "drm-rp1-depends-on-instead-of-select-MFD_RP1.patch"; patch = pkgs.fetchpatch { url = "https://github.com/peat-psuwit/rpi-linux/commit/6de0bb51929cd3ad4fa27b2a421a2af12e6468f5.patch"; hash = "sha256-9pHcbgWTiztu48SBaLPVroUnxnXMKeCGt5vEo9V8WGw="; }; } { name = "iommu-bcm2712-don-t-allow-building-as-module.patch"; patch = pkgs.fetchpatch { url = "https://github.com/peat-psuwit/rpi-linux/commit/693a5e69bddbcbe1d1b796ebc7581c3597685b1b.patch"; hash = "sha256-8BYYQDM5By8cTk48ASYKJhGVQnZBIK4PXtV70UtfS+A="; }; } ]; }; } ); # Stop ZFS kernel being built supportedFilesystems = lib.mkForce [ "btrfs" "cifs" "f2fs" "jfs" "ntfs" "reiserfs" "vfat" "xfs" ]; tmp.cleanOnBoot = true; }; # Fix missing modules # https://github.com/NixOS/nixpkgs/issues/154163 nixpkgs.overlays = [ (final: prev: { makeModulesClosure = x: prev.makeModulesClosure (x // { allowMissing = true; }); }) (final: prev: { raspberrypifw = let version = "1.20240529"; srcHash = "sha256-KsCo7ZG6vKstxRyFljZtbQvnDSqiAPdUza32xTY/tlA="; in pkgs.raspberrypifw.override { argsOverride = { src = prev.fetchFromGitHub { owner = "raspberrypi"; repo = "firmware"; rev = "${version}"; hash = srcHash; }; }; }; }) ]; fileSystems = { "/" = { device = "/dev/disk/by-label/NIXOS_SD"; fsType = "ext4"; options = [ "noatime" ]; }; }; }