nixos-config/config/vf2.nix

120 lines
2.8 KiB
Nix

{
lib,
nix-packages,
config,
pkgs,
nixpkgs,
...
} @ args: {
networking.hostName = "vf2";
networking.hostId = "ad325df9";
imports = [
./services/caddy
./services/acme.nix
./services/fail2ban.nix
./users/remote-build.nix
];
environment.noXlibs = true;
nixpkgs.config.allowUnsupportedSystem = true;
nixpkgs.overlays = [
(import ../overlays/riscv.nix)
];
nix.settings.substituters = ["https://beam.attic.rs/riscv"];
boot = {
supportedFilesystems = lib.mkForce ["vfat" "ext4"];
kernelPackages = pkgs.vf2KernelPackages;
kernelParams = [
"console=tty0"
"console=ttyS0,115200"
"earlycon=sbi"
"boot.shell_on_fail"
];
blacklistedKernelModules = [
# Last thing to log before crash...
"axp15060-regulator"
# Also sus
"at24"
# Also also sus
"jh7110-vin"
# Maybe??
"starfive-jh7110-regulator"
# This one stopped the crashing
"starfivecamss"
];
initrd.includeDefaultModules = false;
initrd.availableKernelModules = [
"dw_mmc-pltfm"
"dw_mmc-starfive"
"dwmac-starfive-plat"
"spi-dw-mmio"
"mmc_block"
"nvme"
"sdhci" #?
"sdhci-pci" #?
"sdhci-of-dwcmshc"
];
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
};
fileSystems = {
"/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
options = ["nofail" "noauto"];
};
"/" = {
device = "192.168.2.1:/export/vf2";
fsType = "nfs";
options = ["nofail" "local_lock=all" "nfsvers=4.2"];
};
};
boot.initrd.network.enable = true;
hardware.deviceTree.name = "starfive/jh7110-visionfive-v2.dtb";
system.stateVersion = "23.05";
home-manager.users.darkkirb = import ./home-manager/darkkirb.nix {
desktop = false;
inherit args;
};
nix.settings.cores = 4;
nix.settings.max-jobs = 4;
nix.settings.system-features = [
"nixos-test"
"big-parallel"
"benchmark"
"ca-derivations"
"gccarch-riscv-i"
"gccarch-riscv-m"
"gccarch-riscv-a"
"gccarch-riscv-f"
"gccarch-riscv-d"
"gccarch-riscv-c"
];
nix.daemonCPUSchedPolicy = "idle";
nix.daemonIOSchedClass = "idle";
sops.secrets."root/.ssh/id_ed25519" = {
owner = "root";
path = "/root/.ssh/id_ed25519";
};
system.autoUpgrade.allowReboot = true;
services.tailscale.useRoutingFeatures = "server";
boot.kernel.sysctl."net.ipv4.conf.all.forwarding" = true;
nixpkgs = {
buildPlatform.config = "x86_64-linux";
hostPlatform.config = "riscv64-linux";
pkgs = lib.mkForce (import nixpkgs {
system = "x86_64-linux";
crossSystem = "riscv64-linux";
inherit (config.nixpkgs) config overlays;
});
};
}