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,
|
2024-07-05 12:59:06 +00:00
|
|
|
riscv-overlay,
|
2024-09-27 10:48:25 +00:00
|
|
|
lix,
|
2023-03-03 09:46:02 +00:00
|
|
|
...
|
2024-09-27 10:48:25 +00:00
|
|
|
} @ args: let
|
2024-09-27 10:54:21 +00:00
|
|
|
pkgs_x86_64 = import nixpkgs {
|
2024-09-27 10:48:25 +00:00
|
|
|
system = "x86_64-linux";
|
|
|
|
crossSystem.system = "riscv64-linux";
|
|
|
|
overlays = [lix.overlays.default];
|
|
|
|
};
|
|
|
|
in {
|
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
|
|
|
];
|
|
|
|
|
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 = [
|
2024-07-05 12:59:06 +00:00
|
|
|
riscv-overlay.overlays.default
|
2024-07-16 13:13:22 +00:00
|
|
|
(self: super: {
|
2024-10-19 05:26:54 +00:00
|
|
|
inherit (pkgs_x86_64) lix nixos-option;
|
2024-07-16 13:13:22 +00:00
|
|
|
})
|
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
|
|
|
|
|
|
|
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 [];
|
2024-07-01 15:51:11 +00:00
|
|
|
|
|
|
|
system.stateVersion = "24.05";
|
2024-07-02 17:30:05 +00:00
|
|
|
|
|
|
|
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";
|
2024-07-03 05:37:50 +00:00
|
|
|
boot.initrd.kernelModules = [
|
2024-07-03 11:48:41 +00:00
|
|
|
"dw_mmc-starfive"
|
|
|
|
"motorcomm"
|
|
|
|
"dwmac-starfive"
|
|
|
|
"cdns3-starfive"
|
|
|
|
"jh7110-trng"
|
|
|
|
"phy-jh7110-usb"
|
|
|
|
"clk-starfive-jh7110-aon"
|
|
|
|
"clk-starfive-jh7110-stg"
|
|
|
|
"clk-starfive-jh7110-vout"
|
|
|
|
"clk-starfive-jh7110-isp"
|
|
|
|
"clk-starfive-jh7100-audio"
|
|
|
|
"phy-jh7110-pcie"
|
|
|
|
"pcie-starfive"
|
2024-07-03 05:37:50 +00:00
|
|
|
"nvme"
|
|
|
|
];
|
|
|
|
systemd.network.enable = true;
|
2024-07-03 05:50:52 +00:00
|
|
|
networking.useNetworkd = true;
|
2023-03-03 09:46:02 +00:00
|
|
|
}
|