start working on router config

This commit is contained in:
chayleaf 2023-05-17 15:27:00 +07:00
parent 600654b33f
commit 3a46dc3c2a
5 changed files with 73 additions and 3 deletions

View file

@ -69,6 +69,13 @@
./hosts/nixserver
] ++ common "nixserver";
};
router = {
system = "aarch64-linux";
modules = [
./hardware/bpi_r3.nix
./hosts/router
];
};
};
};
}

View file

@ -0,0 +1,35 @@
{ pkgs
, lib
, ... }:
# WIP
{
boot.loader = {
grub.enable = false;
generic-extlinux-compatible.enable = true;
};
# https://github.com/frank-w/BPI-Router-Linux
boot.kernelPackages = pkgs.linuxPackagesFor ((pkgs.buildLinux ({
version = "6.3";
modDirVersion = "6.3.0";
src = pkgs.fetchFromGitHub {
owner = "frank-w";
repo = "BPI-Router-Linux";
rev = "6.3-main";
hash = lib.fakeHash;
};
defconfig = "mt7986a_bpi-r3";
})).overrideAttrs (old: {
postConfigure = ''
sed -i "$buildRoot/.config" -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
sed -i "$buildRoot/include/config/auto.conf" -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
'';
}));
hardware.deviceTree.enable = true;
hardware.deviceTree.filter = "mt7986a-bananapi-bpi-r3*.dtb";
hardware.enableRedistributableFirmware = true;
}

View file

@ -70,10 +70,10 @@ in {
enable = true;
path = /persist;
directories = [
{ directory = /var/www/${cfg.domainName}; }
{ directory = /home/${config.common.mainUsername}; }
{ directory = /home/${config.common.mainUsername}; user = config.common.mainUsername; group = config.common.mainUsername; mode = "0700"; }
{ directory = /root; }
{ directory = /nix; }
{ directory = /var/www/${cfg.domainName}; }
];
};
services.beesd = {

View file

@ -0,0 +1,28 @@
{ config
, ... }:
let
rootUuid = "00000000-0000-0000-0000-000000000000";
rootPart = "/dev/disk/by-uuid/${rootUuid}";
in {
system.stateVersion = "22.11";
# TODO
fileSystems = {
# mount root on tmpfs
"/" = { device = "none"; fsType = "tmpfs"; neededForBoot = true;
options = [ "defaults" "size=2G" "mode=755" ]; };
"/persist" =
{ device = rootPart; fsType = "btrfs"; neededForBoot = true;
options = [ ]; };
};
impermanence = {
enable = true;
path = /persist;
directories = [
{ directory = /home/${config.common.mainUsername}; user = config.common.mainUsername; group = config.common.mainUsername; mode = "0700"; }
{ directory = /root; mode = "0700"; }
/nix
/boot
];
};
}

View file

@ -12,7 +12,7 @@ in {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable GPU passthrough config (probably no intel/nvidia support since I can't test it)";
description = "Enable GPU passthrough + VM config (probably no intel/nvidia support since I can't test it)";
};
libvirtdGroup = mkOption {
type = with types; listOf str;