refactor: added flake parts
This commit is contained in:
parent
db7ac35613
commit
88041e86bd
66 changed files with 3538 additions and 2163 deletions
158
modules/hosts/nixos/twilight/configuration.nix
Normal file
158
modules/hosts/nixos/twilight/configuration.nix
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
{...}: {
|
||||
flake.nixosModules.twilightConfiguration = {
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
boot.initrd.availableKernelModules = ["usb_storage"];
|
||||
boot.kernelModules = ["sg"];
|
||||
|
||||
boot.loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
"vpn-keys/tailscale-authkey/twilight" = {
|
||||
sopsFile = "${inputs.secrets}/vpn-keys.yaml";
|
||||
};
|
||||
};
|
||||
host = {
|
||||
users = {
|
||||
leyla = {
|
||||
isDesktopUser = true;
|
||||
isTerminalUser = true;
|
||||
isPrincipleUser = true;
|
||||
};
|
||||
eve.isDesktopUser = true;
|
||||
};
|
||||
hardware = {
|
||||
piperMouse.enable = true;
|
||||
viaKeyboard.enable = true;
|
||||
openRGB.enable = true;
|
||||
graphicsAcceleration.enable = true;
|
||||
directAccess.enable = true;
|
||||
};
|
||||
ai = {
|
||||
enable = true;
|
||||
# TODO: benchmark twilight against defiant and prune this list of models that are faster on defiant
|
||||
models = {
|
||||
# conversation models
|
||||
"Llama 3.1 8B" = {
|
||||
model = "lamma3.1:8b";
|
||||
roles = ["chat" "edit" "apply"];
|
||||
};
|
||||
"deepseek-r1:8b" = {
|
||||
model = "deepseek-r1:8b";
|
||||
roles = ["chat" "edit" "apply"];
|
||||
};
|
||||
"deepseek-r1:32b" = {
|
||||
model = "deepseek-r1:32b";
|
||||
roles = ["chat" "edit" "apply"];
|
||||
};
|
||||
|
||||
# auto complete models
|
||||
"qwen2.5-coder:1.5b-base" = {
|
||||
model = "qwen2.5-coder:1.5b-base";
|
||||
roles = ["autocomplete"];
|
||||
};
|
||||
"qwen2.5-coder:7b" = {
|
||||
model = "qwen2.5-coder:7b";
|
||||
roles = ["autocomplete"];
|
||||
};
|
||||
"deepseek-coder:6.7b" = {
|
||||
model = "deepseek-coder:6.7b";
|
||||
roles = ["autocomplete"];
|
||||
};
|
||||
"deepseek-coder:33b" = {
|
||||
model = "deepseek-coder:33b";
|
||||
roles = ["autocomplete"];
|
||||
};
|
||||
|
||||
# agent models
|
||||
"qwen3:32b" = {
|
||||
model = "qwen3:32b";
|
||||
roles = ["chat" "edit" "apply"];
|
||||
};
|
||||
|
||||
# embedding models
|
||||
"nomic-embed-text:latest" = {
|
||||
model = "nomic-embed-text:latest";
|
||||
roles = ["embed"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
services = {
|
||||
ollama = {
|
||||
enable = true;
|
||||
exposePort = true;
|
||||
|
||||
loadModels = [
|
||||
# conversation models
|
||||
"llama3.1:8b"
|
||||
"deepseek-r1:8b"
|
||||
"deepseek-r1:32b"
|
||||
|
||||
# auto complete models
|
||||
"qwen2.5-coder:1.5b-base"
|
||||
"qwen2.5-coder:7b"
|
||||
"deepseek-coder:6.7b"
|
||||
"deepseek-coder:33b"
|
||||
|
||||
# agent models
|
||||
"qwen3:32b"
|
||||
|
||||
# embedding models
|
||||
"nomic-embed-text:latest"
|
||||
];
|
||||
};
|
||||
|
||||
tailscale = {
|
||||
enable = true;
|
||||
authKeyFile = config.sops.secrets."vpn-keys/tailscale-authkey/twilight".path;
|
||||
useRoutingFeatures = "both";
|
||||
extraUpFlags = [
|
||||
"--advertise-exit-node"
|
||||
"--advertise-routes=192.168.0.0/24"
|
||||
];
|
||||
extraSetFlags = [
|
||||
"--advertise-exit-node"
|
||||
"--advertise-routes=192.168.0.0/24"
|
||||
];
|
||||
};
|
||||
|
||||
syncthing.enable = true;
|
||||
};
|
||||
|
||||
# Enable network-online.target for better network dependency handling
|
||||
systemd.services.NetworkManager-wait-online.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
cachefilesd
|
||||
];
|
||||
hardware.steam-hardware.enable = true; # Provides udev rules for controller, HTC vive, and Valve Index
|
||||
|
||||
networking = {
|
||||
networkmanager.enable = true;
|
||||
hostName = "twilight"; # Define your hostname.
|
||||
};
|
||||
|
||||
# enabled virtualisation for docker
|
||||
# virtualisation.docker.enable = true;
|
||||
|
||||
# Enable touchpad support (enabled default in most desktopManager).
|
||||
# services.xserver.libinput.enable = true;
|
||||
|
||||
# This value determines the NixOS release from which the default
|
||||
# settings for stateful data, like file locations and database versions
|
||||
# on your system were taken. It's perfectly fine and recommended to leave
|
||||
# this value at the release version of the first install of this system.
|
||||
# Before changing this value read the documentation for this option
|
||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||
system.stateVersion = "23.05"; # Did you read the comment?
|
||||
};
|
||||
}
|
||||
21
modules/hosts/nixos/twilight/default.nix
Normal file
21
modules/hosts/nixos/twilight/default.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# leyla desktop
|
||||
{
|
||||
inputs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
flake.nixosConfigurations.twilight = inputs.nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
config.flake.nixosModules.nixosModules
|
||||
config.flake.nixosModules.twilightConfiguration
|
||||
config.flake.nixosModules.twilightHardwareConfiguration
|
||||
config.flake.nixosModules.twilightNvidiaDriver
|
||||
# config.flake.nixosModules.twilightNetworkMount
|
||||
];
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
syncthingConfiguration = inputs.self.syncthingConfiguration;
|
||||
};
|
||||
};
|
||||
}
|
||||
44
modules/hosts/nixos/twilight/hardware-configuration.nix
Normal file
44
modules/hosts/nixos/twilight/hardware-configuration.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{...}: {
|
||||
# Do not modify this file! It was generated by 'nixos-generate-config'
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
flake.nixosModules.twilightHardwareConfiguration = {
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "sd_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-amd"];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-id/nvme-Samsung_SSD_980_500GB_S64ENJ0RA06463Z-part2";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
"/boot" = {
|
||||
device = "/dev/disk/by-id/nvme-Samsung_SSD_980_500GB_S64ENJ0RA06463Z-part1";
|
||||
fsType = "vfat";
|
||||
options = ["fmask=0022" "dmask=0022"];
|
||||
};
|
||||
};
|
||||
|
||||
swapDevices = [];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
};
|
||||
}
|
||||
74
modules/hosts/nixos/twilight/network-mount.nix
Normal file
74
modules/hosts/nixos/twilight/network-mount.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{...}: {
|
||||
flake.nixosModules.twilightNetworkMount = {...}: {
|
||||
boot.supportedFilesystems = ["nfs"];
|
||||
|
||||
fileSystems = {
|
||||
"/mnt/leyla_documents" = {
|
||||
device = "defiant:/exports/leyla_documents";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"noatime"
|
||||
"nofail"
|
||||
"soft"
|
||||
"intr" # Allow interruption of NFS calls
|
||||
"timeo=50" # 5 second timeout (50 deciseconds) - longer than mobile
|
||||
"retrans=3" # 3 retries for desktop
|
||||
"x-systemd.idle-timeout=600" # 10 minute idle timeout for desktop
|
||||
"x-systemd.device-timeout=30" # 30 second device timeout
|
||||
"bg" # Background mount - don't block boot
|
||||
"fsc" # Enable caching
|
||||
"_netdev" # Network device - wait for network
|
||||
"x-systemd.requires=network-online.target" # Require network to be online
|
||||
"x-systemd.after=network-online.target" # Start after network is online
|
||||
];
|
||||
};
|
||||
|
||||
"/mnt/users_documents" = {
|
||||
device = "defiant:/exports/users_documents";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"nofail"
|
||||
"soft"
|
||||
"intr"
|
||||
"timeo=50"
|
||||
"retrans=3"
|
||||
"x-systemd.idle-timeout=600"
|
||||
"bg"
|
||||
"fsc"
|
||||
"_netdev"
|
||||
"x-systemd.requires=network-online.target"
|
||||
"x-systemd.after=network-online.target"
|
||||
];
|
||||
};
|
||||
|
||||
"/mnt/media" = {
|
||||
device = "defiant:/exports/media";
|
||||
fsType = "nfs";
|
||||
options = [
|
||||
"x-systemd.automount"
|
||||
"noauto"
|
||||
"noatime"
|
||||
"nofail"
|
||||
"soft"
|
||||
"intr"
|
||||
"timeo=50"
|
||||
"retrans=3"
|
||||
"x-systemd.idle-timeout=600"
|
||||
"x-systemd.device-timeout=30"
|
||||
"bg"
|
||||
# Desktop-optimized read settings
|
||||
"rsize=32768" # Larger read size for desktop
|
||||
"wsize=32768" # Larger write size for desktop
|
||||
"fsc"
|
||||
"_netdev"
|
||||
"x-systemd.requires=network-online.target"
|
||||
"x-systemd.after=network-online.target"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
50
modules/hosts/nixos/twilight/nvidia-drivers.nix
Normal file
50
modules/hosts/nixos/twilight/nvidia-drivers.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{...}: {
|
||||
flake.nixosModules.twilightNvidiaDriver = {config, ...}: {
|
||||
services = {
|
||||
xserver = {
|
||||
# Load nvidia driver for Xorg and Wayland
|
||||
videoDrivers = ["nvidia"];
|
||||
};
|
||||
# Temporarily enable wayland to fix boot issue
|
||||
# TODO: Investigate proper X11 session generation for gaming
|
||||
displayManager.gdm.wayland = true;
|
||||
};
|
||||
|
||||
hardware = {
|
||||
# Enable OpenGL
|
||||
graphics.enable = true;
|
||||
|
||||
# install graphics drivers
|
||||
nvidia = {
|
||||
# Modesetting is required.
|
||||
modesetting.enable = true;
|
||||
|
||||
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
||||
# Enable this if you have graphical corruption issues or application crashes after waking
|
||||
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
||||
# of just the bare essentials.
|
||||
powerManagement.enable = true;
|
||||
|
||||
# Fine-grained power management. Turns off GPU when not in use.
|
||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||
powerManagement.finegrained = false;
|
||||
|
||||
# Use the NVidia open source kernel module (not to be confused with the
|
||||
# independent third-party "nouveau" open source driver).
|
||||
# Support is limited to the Turing and later architectures. Full list of
|
||||
# supported GPUs is at:
|
||||
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
|
||||
# Only available from driver 515.43.04+
|
||||
# Currently alpha-quality/buggy, so false is currently the recommended setting.
|
||||
open = true;
|
||||
|
||||
# Enable the Nvidia settings menu,
|
||||
# accessible via `nvidia-settings`.
|
||||
nvidiaSettings = true;
|
||||
|
||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||
package = config.boot.kernelPackages.nvidiaPackages.production;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue