WIP raspberry pi support

This commit is contained in:
Pim Kunis 2024-02-26 23:08:12 +01:00
parent 510dd8cf8a
commit c2e2ed5ea8
5 changed files with 63 additions and 34 deletions

View file

@ -1,6 +1,18 @@
{
warwick = {
type = "physical";
arch = "aarch64-linux";
nixosModule.lab = {
storage = {
osDisk = "/dev/sda";
};
};
};
atlas = {
type = "physical";
arch = "x86_64-linux";
nixosModule.lab = {
storage = {
@ -18,6 +30,7 @@
jefke = {
type = "physical";
arch = "x86_64-linux";
nixosModule = {
lab = {
@ -37,6 +50,7 @@
lewis = {
type = "physical";
arch = "x86_64-linux";
nixosModule.lab = {
backups.enable = true;

View file

@ -35,7 +35,7 @@ in {
networking = {
domain = if machine.type == "physical" then "hyp" else "dmz";
nftables.enable = true;
useDHCP = false;
useDHCP = true;
firewall = {
enable = true;
@ -43,7 +43,7 @@ in {
};
};
systemd.network = lib.mkIf (machine.type == "physical") {
systemd.network = lib.mkIf (false && machine.type == "physical") {
enable = true;
netdevs = {

View file

@ -10,7 +10,8 @@ in {
};
dataPartition = lib.mkOption {
type = lib.types.str;
default = null;
type = lib.types.nullOr lib.types.str;
description = ''
Partition to be used for data storage on this machine.
'';
@ -25,8 +26,10 @@ in {
};
};
config = lib.mkIf (machine.type == "physical") {
fileSystems.${cfg.dataMountPoint}.device = cfg.dataPartition;
config = lib.mkIf (false && machine.type == "physical") {
fileSystems.${cfg.dataMountPoint} = lib.mkIf (! isNull cfg.dataPartition) {
device = cfg.dataPartition;
};
# TODO: Rename this to 'osDisk'. Unfortunately, we would need to run nixos-anywhere again then.
disko.devices.disk.vdb = {

View file

@ -1,39 +1,50 @@
{ pkgs, config, lib, modulesPath, microvm, disko, agenix, machines, dns, ... }: {
{ pkgs, config, lib, modulesPath, microvm, disko, agenix, machines, dns, machine, ... }: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
microvm.nixosModules.host
];
config = {
boot = {
kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ];
initrd = {
availableKernelModules = [
"ahci"
"xhci_pci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
kernelModules = [ ];
};
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
options = [ "noatime" ];
};
};
boot.loader.grub.device = "/dev/sda";
# boot = {
# # kernelModules = [ "kvm-intel" ];
# kernelModules = [ ];
# extraModulePackages = [ ];
# initrd = {
# availableKernelModules = [
# "ahci"
# "xhci_pci"
# "nvme"
# "usbhid"
# "usb_storage"
# "sd_mod"
# "sdhci_pci"
# ];
# kernelModules = [ ];
# };
# loader = {
# # systemd-boot.enable = true;
# efi.canTouchEfiVariables = true;
# };
# };
nixpkgs = {
config.allowUnfree = true;
hostPlatform = "x86_64-linux";
# hostPlatform = machine.arch;
};
hardware.cpu.intel.updateMicrocode = config.hardware.enableRedistributableFirmware;
# hardware.cpu.intel.updateMicrocode = config.hardware.enableRedistributableFirmware;
age.identityPaths = [ "/etc/age_ed25519" ];