Files
nixos-config/hosts/ender-ml/configuration.nix
T

284 lines
6.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
config,
pkgs,
pkgs-unstable,
inputs,
configPath,
hostname,
hostTypes,
lib,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
# Declarative disk layout (consumed by disko + nixos-anywhere).
./disko-config.nix
inputs.home-manager.nixosModules.default
];
#Kernel
# boot.kernelPackages = pkgs.linuxKernel.packages.linux_zen;
boot.kernelPackages = pkgs-unstable.linuxKernel.packages.linux_zen;
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.graceful = true;
nix.settings.experimental-features = ["nix-command" "flakes"];
# Nix optimizations
nix.optimise.automatic = true;
nix.settings.auto-optimise-store = true;
nix.gc = {
automatic = true;
dates = "weekly";
persistent = true;
options = "--delete-older-than 30d";
};
# Btrfs filesystem
services.btrfs.autoScrub = {
enable = true;
interval = "weekly";
fileSystems = ["/" "/home" "/nix"];
};
# Snapper — automatic btrfs snapshots so you can roll back
services.snapper = {
# Snapshot / every hour, keep 10 hourly and 7 daily
configs.root = {
SUBVOLUME = "/";
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_MIN_AGE = "1800";
TIMELINE_LIMIT_HOURLY = "10";
TIMELINE_LIMIT_DAILY = "7";
TIMELINE_LIMIT_MONTHLY = "3";
TIMELINE_LIMIT_YEARLY = "0";
};
# Snapshot /home every 4 hours
configs.home = {
SUBVOLUME = "/home";
TIMELINE_CREATE = true;
TIMELINE_CLEANUP = true;
TIMELINE_MIN_AGE = "14400";
TIMELINE_LIMIT_HOURLY = "6";
TIMELINE_LIMIT_DAILY = "14";
TIMELINE_LIMIT_MONTHLY = "3";
TIMELINE_LIMIT_YEARLY = "0";
};
};
networking.hostName = "ender-ml"; # Define your hostname.
# Enable networking
networking.networkmanager.enable = true;
# Virtualisation
virtualisation.docker.enable = true;
services.qemuGuest.enable = true;
services.spice-vdagentd.enable = true;
# zram
zramSwap = {
enable = true;
priority = 100;
memoryPercent = 30;
swapDevices = 1;
algorithm = "zstd";
};
# Enable OpenGL
hardware.graphics = {
enable = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
open = false;
# 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.latest;
package = pkgs-unstable.linuxKernel.packages.linux_zen.nvidia_x11;
};
nix.settings = {
substituters = ["https://cache.nixos-cuda.org"];
trusted-public-keys = ["cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M="];
};
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Disable X11 for servers
services.xserver.enable = false;
services.tailscale.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "us";
variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = false;
# Enable sound with pipewire.
# hardware.pulseaudio.enable = false;
#hardware.pulseaudio = {
# enable = true;
# package = pkgs.pulseaudioFull;
#};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# VSCode-Server
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
stdenv.cc.cc.lib
zlib
glib
libGL
libGLU
openssl
];
# Enable ollama
services.ollama = {
enable = true;
host = "0.0.0.0";
openFirewall = true;
package = pkgs-unstable.ollama-cuda;
environmentVariables = {
CUDA_VISIBLE_DEVICES = "0,1";
};
};
services.comfyui = {
enable = true;
enableManager = true;
port = 8188;
openFirewall = true;
listenAddress = "0.0.0.0";
dataDir = "/home/rogueking/models/comfyui-data";
user = "rogueking";
group = "users";
package = pkgs-unstable.comfy-ui-cuda;
#createUser = true; # Use existing user
# If dataDir is on a separate mount (NFS, ZFS dataset, etc.):
# requiresMounts = [ "home-myuser-comfyui\\x2ddata.mount" ];
};
# Enable llama-cpp server
services.llama-cpp = {
enable = true;
package = pkgs-unstable.llama-cpp.override {cudaSupport = true;};
model = "/home/rogueking/models";
host = "0.0.0.0";
port = 8080;
# extraFlags = [
# "n-gpu-layers 99"
# ];
};
# Define a user account. Don't forget to set a password with passwd.
programs.zsh.enable = true;
users.users.rogueking = {
isNormalUser = true;
description = "rogueking";
extraGroups = ["networkmanager" "wheel" "docker"];
shell = pkgs.zsh;
packages = with pkgs; [];
};
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
security.polkit.enable = true;
programs._1password.enable = true;
programs._1password-gui = {
enable = true;
polkitPolicyOwners = ["rogueking"];
};
# Enable OpenSSH daemon
services.openssh = {
enable = true;
ports = [22];
settings = {
PasswordAuthentication = true;
AllowUsers = ["rogueking"];
UseDns = true;
X11Forwarding = false;
PermitRootLogin = "no";
MaxAuthTries = 12;
};
};
users.users."rogueking".openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINXqriPZVIuduc/J7GS1mD171LL0gIbgEjlImsxedWVX"
];
nixpkgs.config.permittedInsecurePackages = [
"qtwebengine-5.15.19"
"python3.12-ecdsa-0.19.1"
];
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# System-level only — CLI tools moved to home-manager
btop-cuda # cuda variant must stay system-level with nvidia drivers
];
home-manager = {
extraSpecialArgs = {
inherit
configPath
inputs
pkgs-unstable
hostname
hostTypes
;
};
users = {
"rogueking" = import ./../../home-manager/home.nix;
};
backupFileExtension = "backup";
};
system.stateVersion = "26.05";
}