nixos-config/config/vf2.nix

121 lines
3 KiB
Nix
Raw Normal View History

2023-03-03 09:46:02 +00:00
{
lib,
config,
pkgs,
2023-06-12 12:40:57 +00:00
nixpkgs,
2024-07-01 15:51:11 +00:00
nixos-hardware,
2023-03-03 09:46:02 +00:00
...
2023-03-03 09:54:31 +00:00
} @ args: {
2024-07-02 12:27:28 +00:00
networking.hostName = "vf2";
networking.hostId = "ad325df9";
2023-03-03 09:46:02 +00:00
imports = [
2024-07-02 12:27:28 +00:00
./services/caddy
./services/acme.nix
./users/remote-build.nix
./systemd-boot.nix
"${nixos-hardware}/starfive/visionfive/v2/default.nix"
2023-03-03 09:46:02 +00:00
];
2024-07-02 12:27:28 +00:00
environment.noXlibs = true;
2023-03-04 17:35:33 +00:00
nixpkgs.config.allowUnsupportedSystem = true;
2023-03-04 07:55:40 +00:00
2023-03-03 09:46:02 +00:00
nixpkgs.overlays = [
2023-06-18 08:09:13 +00:00
(import ../overlays/riscv.nix args)
2023-03-03 09:46:02 +00:00
];
nix.settings.substituters = lib.mkForce [
"https://beam.attic.rs/riscv"
"https://cache.ztier.in"
"https://hydra.int.chir.rs"
];
2023-03-03 09:46:02 +00:00
fileSystems = {
2023-06-15 06:31:38 +00:00
"/boot" = {
2024-07-02 12:27:28 +00:00
device = "/dev/nvme0n1p1";
2023-03-03 09:46:02 +00:00
fsType = "vfat";
2023-06-15 06:31:38 +00:00
options = ["nofail"];
2023-03-03 09:46:02 +00:00
};
"/" = {
2024-07-02 12:27:28 +00:00
device = "/dev/nvme0n1p2";
fsType = "btrfs";
options = ["compress=zstd"];
2023-03-03 09:46:02 +00:00
};
};
2024-07-02 12:27:28 +00:00
swapDevices = [
{
device = "/dev/nvme0n1p3";
}
];
# hardware.deviceTree.name = "starfive/jh7110-starfive-visionfive-2-v1.3b.dtb";
2023-03-03 09:54:31 +00:00
home-manager.users.darkkirb = import ./home-manager/darkkirb.nix {
desktop = false;
inherit args;
};
2023-03-06 14:44:47 +00:00
nix.settings.cores = 4;
nix.settings.max-jobs = 4;
2023-03-03 09:54:31 +00:00
nix.settings.system-features = [
"nixos-test"
"big-parallel"
"benchmark"
"ca-derivations"
2023-06-18 14:47:12 +00:00
# There are many more combinations but i simply do not care lol
"gccarch-rv64gc_zba_zbb"
"gccarch-rv64gc_zba"
"gccarch-rv64gc_zbb"
"gccarch-rv64gc"
"gccarch-rv32gc_zba_zbb"
"gccarch-rv32gc_zba"
"gccarch-rv32gc_zbb"
"gccarch-rv32gc"
2023-10-19 08:02:43 +00:00
"native-riscv"
2023-03-03 09:54:31 +00:00
];
nix.daemonCPUSchedPolicy = "idle";
nix.daemonIOSchedClass = "idle";
services.tailscale.useRoutingFeatures = "server";
2023-06-11 14:30:56 +00:00
2023-06-24 13:18:08 +00:00
boot.binfmt.emulatedSystems = [
"x86_64-linux"
];
2024-07-02 17:05:17 +00:00
boot.loader.efi.canTouchEfiVariables = true;
2024-07-02 13:06:41 +00:00
boot.loader.generic-extlinux-compatible.enable = false;
2024-07-02 12:27:28 +00:00
#system.requiredKernelConfig = lib.mkForce [];
system.autoUpgrade.allowReboot = true;
2024-07-01 15:51:11 +00:00
nixpkgs.crossSystem = {
config = "riscv64-unknown-linux-gnu";
system = "riscv64-linux";
};
system.stateVersion = "24.05";
boot.loader.systemd-boot.extraInstallCommands = ''
set -euo pipefail
${pkgs.coreutils}/bin/cp --no-preserve=mode -r ${config.hardware.deviceTree.package} ${config.boot.loader.efi.efiSysMountPoint}/
for filename in ${config.boot.loader.efi.efiSysMountPoint}/loader/entries/nixos*-generation-[1-9]*.conf; do
if ! ${pkgs.gnugrep}/bin/grep -q 'devicetree' $filename; then
${pkgs.coreutils}/bin/echo "devicetree /dtbs/${config.hardware.deviceTree.name}" >> $filename
fi
done
'';
2024-07-02 17:56:42 +00:00
hardware.deviceTree.name = "starfive/jh7110-starfive-visionfive-2-v1.3b.dtb";
boot.initrd.kernelModules = [
"nvme"
"pcie_starfive"
"phy_jh7110_pcie"
"dwmac_starfive"
"stmmac_platform"
"clk_starfive_jh7110_vout"
"cdns3_starfive"
"clk_starfive_jh7110_isp"
"clk_starfive_jh7110_aon"
"clk_starfive_jh7110_stg"
"dw_mmc_starfive"
"jh7110_pwmdac"
"jh7110_tdm"
"jh7110_trng"
"phy_jh7110_dphy_rx"
"phy_jh7110_usb"
];
systemd.network.enable = true;
2023-03-03 09:46:02 +00:00
}