dotfiles/hosts/Aloria/default.nix

210 lines
5.9 KiB
Nix
Raw Normal View History

2024-06-05 13:28:56 +02:00
{ pkgs, config, ... }:
2024-06-05 02:11:35 +02:00
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
2024-06-04 22:13:24 +02:00
{
services.pcscd.enable = true;
2024-06-05 13:28:56 +02:00
services.xserver.videoDrivers = ["nvidia"];
2024-06-05 01:02:16 +02:00
hardware.opengl.extraPackages = [
pkgs.intel-compute-runtime
pkgs.intel-media-driver
];
2024-06-05 13:28:56 +02:00
services.thermald.enable = true;
services.fwupd.enable = true;
2024-06-08 17:31:27 +02:00
services.fstrim.enable = true;
2024-06-05 13:28:56 +02:00
environment.systemPackages = with pkgs; [
wireguard-tools
2024-06-07 01:01:14 +02:00
# Podman
dive
podman-tui
docker-compose
2024-06-05 13:28:56 +02:00
# 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 = {
2024-06-05 14:31:58 +02:00
docked.configuration = {
2024-06-05 13:28:56 +02:00
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;
};
};
};
2024-06-04 22:13:24 +02:00
services.udev.packages = [ pkgs.yubikey-personalization ];
2024-06-08 17:31:27 +02:00
2024-06-07 01:01:14 +02:00
# Enable common container config files in /etc/containers
virtualisation.containers.enable = true;
virtualisation = {
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
};
services.ollama = {
enable = true;
acceleration = "cuda";
};
2024-06-04 22:13:24 +02:00
# Calendar
programs.dconf.enable = true;
services.gnome.evolution-data-server.enable = true;
services.gnome.gnome-online-accounts.enable = true;
services.gnome.gnome-keyring.enable = true;
# Add the server using gnome-online-accounts:
# nix-shell -p gnome.gnome-control-center --run "gnome-control-center"
# Just add the main webdav server and gnome-calendar will automatically pick up all available calendars.
2024-06-05 02:23:39 +02:00
# networking.nameservers = [ "1.1.1.1#one.one.one.one" "1.0.0.1#one.one.one.one" ];
# services.resolved = {
# enable = true;
# dnssec = "true";
# domains = [ "~." ];
# fallbackDns = [ "1.1.1.1#one.one.one.one" "1.0.0.1#one.one.one.one" ];
# dnsovertls = "true";
# };
2024-06-04 22:13:24 +02:00
networking.wg-quick.interfaces = {
wg0 = {
2024-06-04 23:42:15 +02:00
address = [ "10.0.0.5/24" "2a02:a03f:83ad:2101::5/128" ];
2024-06-05 18:34:54 +02:00
# dns = [ "10.0.0.1" "fdc9:281f:04d7:9ee9::1" ];
2024-06-04 22:13:24 +02:00
privateKeyFile = "/home/user/.secrets/Wireguard/Aloria.key";
listenPort = 51820;
2024-06-05 18:34:54 +02:00
postUp = "resolvectl dns wg0 10.0.0.1; resolvectl domain wg0 ~thomasave.be;";
2024-06-04 22:13:24 +02:00
peers = [{
publicKey = "/9ppjm3yeD0duDvxrqgcHscHmftXko+0s2RbivNEy2c=";
2024-06-04 23:42:15 +02:00
allowedIPs = [ "10.0.0.1/8" "192.168.1.2/32" ];
2024-06-04 22:13:24 +02:00
endpoint = "h.thomasave.be:13231";
persistentKeepalive = 25;
}];
};
};
2024-06-05 02:11:35 +02:00
networking.networkmanager = {
2024-06-05 01:02:16 +02:00
enable = true;
2024-06-05 02:11:35 +02:00
ensureProfiles = {
environmentFiles = [
"/home/user/.secrets/Wireless/Aloria.env"
];
profiles = pkgs.lib.mapAttrs mkConnection connections;
2024-06-05 01:02:16 +02:00
};
2024-06-05 18:34:54 +02:00
dns = "systemd-resolved";
2024-06-05 01:02:16 +02:00
};
2024-06-06 20:15:03 +02:00
networking.networkmanager.wifi.backend = "iwd";
networking.wireless.iwd.enable = true;
networking.wireless.iwd.settings = {
IPv6 = {
Enabled = true;
};
Settings = {
AutoConnect = true;
};
};
2024-06-05 18:34:54 +02:00
services.resolved = {
enable = true;
fallbackDns = [ "1.1.1.1" "1.0.0.1" ];
};
2024-06-05 20:44:34 +02:00
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
services.blueman.enable = true;
systemd.user.services.mpris-proxy = {
description = "Mpris proxy";
after = [ "network.target" "sound.target" ];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
hardware.bluetooth.settings = {
General = {
Experimental = true;
};
};
2024-06-05 01:02:16 +02:00
2024-06-04 22:13:24 +02:00
fileSystems."/home/server" = {
device = "10.1:/home/server";
fsType = "nfs";
2024-06-05 13:28:56 +02:00
options = [ "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" ];
2024-06-04 22:13:24 +02:00
};
fileSystems."/home/user/Workspace" = {
device = "10.1:/home/server/Workspace";
fsType = "nfs";
2024-06-05 13:28:56 +02:00
options = [ "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" ];
2024-06-04 22:13:24 +02:00
};
fileSystems."/home/user/Documents" = {
device = "10.1:/home/server/Storage/Thomas/Documents";
fsType = "nfs";
2024-06-05 13:28:56 +02:00
options = [ "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" ];
2024-06-04 22:13:24 +02:00
};
fileSystems."/home/user/Pictures" = {
device = "10.1:/home/server/Storage/Thomas/Pictures";
fsType = "nfs";
2024-06-05 13:28:56 +02:00
options = [ "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" ];
2024-06-04 22:13:24 +02:00
};
fileSystems."/home/user/Videos" = {
device = "10.1:/home/server/Storage/Thomas/Videos";
fsType = "nfs";
2024-06-05 13:28:56 +02:00
options = [ "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" ];
2024-06-04 22:13:24 +02:00
};
}