130 lines
3.1 KiB
Nix
130 lines
3.1 KiB
Nix
{ pkgs, inputs, config, ... }:
|
|
let
|
|
mkConnection = name: cfg: {
|
|
connection = {
|
|
id = name;
|
|
type = "wifi";
|
|
};
|
|
ipv4 = {
|
|
method = "auto";
|
|
};
|
|
ipv6 = {
|
|
method = "auto";
|
|
};
|
|
wifi = {
|
|
ssid = name;
|
|
mode = "infrastructure";
|
|
};
|
|
wifi-security = {
|
|
auth-alg = "open";
|
|
key-mgmt = "wpa-psk";
|
|
psk = cfg.id;
|
|
};
|
|
};
|
|
connections = {
|
|
"The Buttshark" = {
|
|
id = "$THE_BUTTSHARK";
|
|
};
|
|
"5G Research Tower (5000 Watt)" = {
|
|
id = "$RESEARCH_TOWER";
|
|
};
|
|
"5G Research Tower (2400 Watt)" = {
|
|
id = "$RESEARCH_TOWER";
|
|
};
|
|
};
|
|
in
|
|
{
|
|
imports = [
|
|
(import ../Common { inherit inputs pkgs; })
|
|
];
|
|
|
|
services.xserver.videoDrivers = ["nvidia"];
|
|
hardware.opengl.extraPackages = [
|
|
pkgs.intel-compute-runtime
|
|
pkgs.intel-media-driver
|
|
];
|
|
environment.systemPackages = with pkgs; [
|
|
# Cuda
|
|
pciutils
|
|
file
|
|
gnumake
|
|
gcc
|
|
cudatoolkit
|
|
];
|
|
hardware.nvidia = {
|
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
modesetting.enable = true;
|
|
powerManagement.enable = false;
|
|
powerManagement.finegrained = true;
|
|
open = false;
|
|
nvidiaSettings = true;
|
|
prime = {
|
|
intelBusId = "PCI:0:2:0";
|
|
nvidiaBusId = "PCI:1:0:0";
|
|
offload = {
|
|
enable = true;
|
|
enableOffloadCmd = true;
|
|
};
|
|
};
|
|
};
|
|
systemd.services.nvidia-control-devices = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig.ExecStart = "${pkgs.linuxPackages.nvidia_x11.bin}/bin/nvidia-smi";
|
|
};
|
|
specialisation = {
|
|
docked.configuration = {
|
|
system.nixos.tags = [ "docked" ];
|
|
hardware.nvidia = {
|
|
powerManagement.finegrained = pkgs.lib.mkForce false;
|
|
prime.offload.enable = pkgs.lib.mkForce false;
|
|
prime.offload.enableOffloadCmd = pkgs.lib.mkForce false;
|
|
prime.sync.enable = pkgs.lib.mkForce true;
|
|
};
|
|
};
|
|
};
|
|
|
|
|
|
services.ollama = {
|
|
enable = true;
|
|
acceleration = "cuda";
|
|
};
|
|
|
|
|
|
networking.wg-quick.interfaces = {
|
|
wg0 = {
|
|
address = [ "10.0.0.5/24" "2a02:a03f:83ad:2101::5/128" ];
|
|
# dns = [ "10.0.0.1" "fdc9:281f:04d7:9ee9::1" ];
|
|
privateKeyFile = "/home/user/.secrets/Wireguard/Aloria.key";
|
|
listenPort = 51820;
|
|
postUp = "resolvectl dns wg0 10.0.0.1; resolvectl domain wg0 ~thomasave.be;";
|
|
peers = [{
|
|
publicKey = "/9ppjm3yeD0duDvxrqgcHscHmftXko+0s2RbivNEy2c=";
|
|
allowedIPs = [ "10.0.0.1/8" "192.168.1.2/32" ];
|
|
endpoint = "h.thomasave.be:13231";
|
|
persistentKeepalive = 25;
|
|
}];
|
|
};
|
|
};
|
|
networking.networkmanager = {
|
|
enable = true;
|
|
ensureProfiles = {
|
|
environmentFiles = [
|
|
"/home/user/.secrets/Wireless/Aloria.env"
|
|
];
|
|
profiles = pkgs.lib.mapAttrs mkConnection connections;
|
|
};
|
|
dns = "systemd-resolved";
|
|
};
|
|
networking.networkmanager.wifi.backend = "iwd";
|
|
networking.wireless.iwd.enable = true;
|
|
networking.wireless.iwd.settings = {
|
|
IPv6 = {
|
|
Enabled = true;
|
|
};
|
|
Settings = {
|
|
AutoConnect = true;
|
|
};
|
|
};
|
|
|
|
}
|