2023-03-03 09:46:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
nix-packages,
|
|
|
|
config,
|
|
|
|
pkgs,
|
2023-06-12 12:40:57 +00:00
|
|
|
nixpkgs,
|
2023-03-03 09:46:02 +00:00
|
|
|
...
|
2023-03-03 09:54:31 +00:00
|
|
|
} @ args: {
|
2023-03-03 09:46:02 +00:00
|
|
|
networking.hostName = "vf2";
|
|
|
|
networking.hostId = "ad325df9";
|
|
|
|
imports = [
|
|
|
|
./services/caddy
|
|
|
|
./services/acme.nix
|
2023-03-03 09:54:31 +00:00
|
|
|
./users/remote-build.nix
|
2023-06-15 12:02:43 +00:00
|
|
|
./systemd-boot.nix
|
2023-03-03 09:46:02 +00:00
|
|
|
];
|
|
|
|
|
2023-03-04 07:55:40 +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
|
|
|
];
|
|
|
|
|
2023-06-18 06:22:04 +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
|
|
|
boot = {
|
2023-06-18 06:15:37 +00:00
|
|
|
supportedFilesystems = lib.mkForce ["vfat" "ext4"];
|
|
|
|
kernelPackages = pkgs.linuxPackagesFor pkgs.vf2Kernel;
|
2023-06-15 12:02:43 +00:00
|
|
|
kernelParams = [
|
|
|
|
"console=tty0"
|
|
|
|
"console=ttyS0,115200"
|
|
|
|
"earlycon=sbi"
|
|
|
|
"boot.shell_on_fail"
|
|
|
|
];
|
|
|
|
consoleLogLevel = 7;
|
2023-06-18 06:15:37 +00:00
|
|
|
initrd = {
|
|
|
|
network.enable = true;
|
|
|
|
network.flushBeforeStage2 = false;
|
2023-07-08 16:06:11 +00:00
|
|
|
availableKernelModules =
|
|
|
|
lib.mkForce [
|
|
|
|
];
|
|
|
|
kernelModules = lib.mkForce [];
|
2023-06-18 06:15:37 +00:00
|
|
|
};
|
2023-06-15 12:02:43 +00:00
|
|
|
blacklistedKernelModules = [
|
|
|
|
"clk-starfive-jh7110-vout"
|
|
|
|
];
|
|
|
|
loader.systemd-boot.extraInstallCommands = ''
|
|
|
|
set -euo pipefail
|
|
|
|
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
|
|
|
|
echo "devicetree /dtbs/${config.hardware.deviceTree.name}" >> $filename
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
'';
|
2023-06-18 06:15:37 +00:00
|
|
|
iscsi-initiator = {
|
|
|
|
discoverPortal = "192.168.2.1";
|
|
|
|
name = "iqn.2023-06.rs.chir:rs.chir.int.vf2";
|
|
|
|
target = "iqn.2023-06.rs.chir:rs.chir.int.nas.vf2";
|
|
|
|
};
|
2023-03-03 09:46:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fileSystems = {
|
2023-06-15 06:31:38 +00:00
|
|
|
"/boot" = {
|
2023-06-25 07:28:10 +00:00
|
|
|
device = "/dev/disk/by-uuid/1234-ABCD";
|
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
|
|
|
};
|
|
|
|
"/" = {
|
2023-06-25 07:28:10 +00:00
|
|
|
device = "/dev/disk/by-uuid/b4e8cbe8-a233-444f-920b-c253339a44d6";
|
|
|
|
fsType = "ext4";
|
2023-03-03 09:46:02 +00:00
|
|
|
};
|
|
|
|
};
|
2023-06-15 12:02:43 +00:00
|
|
|
hardware.deviceTree.name = "starfive/jh7110-starfive-visionfive-2-v1.3b.dtb";
|
2023-06-11 14:30:56 +00:00
|
|
|
system.stateVersion = "23.05";
|
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";
|
|
|
|
sops.secrets."root/.ssh/id_ed25519" = {
|
|
|
|
owner = "root";
|
|
|
|
path = "/root/.ssh/id_ed25519";
|
|
|
|
};
|
|
|
|
services.tailscale.useRoutingFeatures = "server";
|
|
|
|
boot.kernel.sysctl."net.ipv4.conf.all.forwarding" = true;
|
2023-06-18 06:15:37 +00:00
|
|
|
networking.useNetworkd = lib.mkForce false;
|
|
|
|
networking.interfaces.end0.useDHCP = true;
|
2023-06-11 14:30:56 +00:00
|
|
|
|
2023-06-18 06:15:37 +00:00
|
|
|
services.openiscsi = {
|
|
|
|
name = "iqn.2023-06.rs.chir:rs.chir.int.vf2";
|
|
|
|
discoverPortal = "192.168.2.1";
|
|
|
|
enable = true;
|
2023-06-11 14:30:56 +00:00
|
|
|
};
|
2023-06-14 10:51:04 +00:00
|
|
|
|
2023-06-24 13:18:08 +00:00
|
|
|
boot.binfmt.emulatedSystems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
];
|
2023-06-25 07:28:10 +00:00
|
|
|
boot.loader.efi.canTouchEfiVariables = lib.mkForce false;
|
2023-07-08 15:29:50 +00:00
|
|
|
system.requiredKernelConfig = lib.mkForce [];
|
2023-03-03 09:46:02 +00:00
|
|
|
}
|