This commit is contained in:
TheCrazyInsanity
2026-03-13 16:22:07 +00:00
9 changed files with 214 additions and 34 deletions

63
flake.lock generated
View File

@@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1764998300, "lastModified": 1772060133,
"narHash": "sha256-fZatn/KLfHLDXnF0wy7JxXqGaZmGDTVufT4o/AOlj44=", "narHash": "sha256-VuyRptb8v1lVGMlLp4/1vRX3Efwec0CN0S6mKmDPzLg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "27a6182347ccae90a88231ae0dc5dfa7d15815bb", "rev": "ce9b6e52500a0ea0ec48f0bbf6d7a3e431d9dfa4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -21,13 +21,38 @@
"type": "github" "type": "github"
} }
}, },
"impermanence": { "home-manager_2": {
"inputs": {
"nixpkgs": [
"impermanence",
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1737831083, "lastModified": 1768598210,
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=", "narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "c47b2cc64a629f8e075de52e4742de688f930dc6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"impermanence": {
"inputs": {
"home-manager": "home-manager_2",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1769548169,
"narHash": "sha256-03+JxvzmfwRu+5JafM0DLbxgHttOQZkUtDWBmeUkN8Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "impermanence", "repo": "impermanence",
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170", "rev": "7b1d382faf603b6d264f58627330f9faa5cba149",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -38,11 +63,27 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1764950072, "lastModified": 1768564909,
"narHash": "sha256-BmPWzogsG2GsXZtlT+MTcAWeDK5hkbGRZTeZNW42fwA=", "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f61125a668a320878494449750330ca58b78c557", "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1771848320,
"narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2fc6539b481e1d2569f25f8799236694180c0993",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -86,4 +127,4 @@
}, },
"root": "root", "root": "root",
"version": 7 "version": 7
} }

View File

@@ -20,6 +20,66 @@
]; ];
nix.package = pkgs.lixPackageSets.stable.lix; nix.package = pkgs.lixPackageSets.stable.lix;
nixpkgs.config.packageOverrides = pkgs: {
# Stolen from https://www.nijho.lt/post/llama-nixos/
llama-cpp =
(pkgs.llama-cpp.override {
cudaSupport = true;
rocmSupport = false;
metalSupport = false;
# Enable BLAS for optimized CPU layer performance (OpenBLAS)
# This is crucial for models using split-mode or CPU offloading
blasSupport = true;
}).overrideAttrs
(oldAttrs: rec {
version = "8184";
src = pkgs.fetchFromGitHub {
owner = "aagit";
repo = "llama.cpp";
# tag = "b${version}";
rev = "6ebf2e0d00d31acfc1a1fa9662e9a7d38bd07bf7"; # https://github.com/ggml-org/llama.cpp/pull/19970
hash = "sha256-xryajW0Cs1d+WDijspMTW21FDaZP9Grkb+uErMQCQ48=";
leaveDotGit = true;
postFetch = ''
git -C "$out" rev-parse --short HEAD > $out/COMMIT
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
};
# Must update npm deps hash to match the new version's webui dependencies
npmDepsHash = "sha256-FKjoZTKm0ddoVdpxzYrRUmTiuafEfbKc4UD2fz2fb8A=";
# Enable native CPU optimizations for massively better CPU performance
# This enables AVX, AVX2, AVX-512, FMA, etc. for your specific CPU
# NOTE: This is intentionally opposite of nixpkgs (which uses -DGGML_NATIVE=off
# for reproducible builds). We sacrifice portability for faster CPU layers.
cmakeFlags = (oldAttrs.cmakeFlags or [ ]) ++ [
"-DGGML_NATIVE=ON"
"-DCMAKE_CUDA_ARCHITECTURES=86" # RTX 3090 - needed since sandbox has no GPU
];
# Disable Nix's NIX_ENFORCE_NO_NATIVE which strips -march=native flags
# See: https://github.com/NixOS/nixpkgs/issues/357736
# See: https://github.com/NixOS/nixpkgs/pull/377484 (intentionally contradicts this)
preConfigure = ''
export NIX_ENFORCE_NO_NATIVE=0
${oldAttrs.preConfigure or ""}
'';
});
# llama-swap from GitHub releases
llama-swap = pkgs.runCommand "llama-swap" { } ''
mkdir -p $out/bin
tar -xzf ${
pkgs.fetchurl {
url = "https://github.com/mostlygeek/llama-swap/releases/download/v190/llama-swap_190_linux_amd64.tar.gz";
hash = "sha256-WAfmJ4YiVH/UYq++l2Ut6oLqkd270HgG7eV+6FG/0Oc=";
}
} -C $out/bin
chmod +x $out/bin/llama-swap
'';
};
# 🇺🇸 # 🇺🇸
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = { i18n.extraLocaleSettings = {
@@ -57,7 +117,7 @@
jack.enable = true; jack.enable = true;
}; };
programs.adb.enable = true; # Bit heavy but you never know when you might need it... # programs.adb.enable = true; # Bit heavy but you never know when you might need it...
users.users.laythe = { users.users.laythe = {
isNormalUser = true; isNormalUser = true;
@@ -110,11 +170,11 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git git
wget wget
wineWowPackages.stable # Heavy but really annoying to not have when you need it wineWow64Packages.stable # Heavy but really annoying to not have when you need it
winetricks winetricks
gparted gparted
unrar unrar
electrum # electrum
qpwgraph qpwgraph
libimobiledevice libimobiledevice
ifuse ifuse
@@ -144,6 +204,7 @@
xmodmap xmodmap
nixfmt nixfmt
units units
android-tools
]; ];
services.usbmuxd = { services.usbmuxd = {

View File

@@ -39,10 +39,81 @@
# }; # };
# This is here because I don't have another computer that could run local AI, and regardless the packages would be different on every one. # This is here because I don't have another computer that could run local AI, and regardless the packages would be different on every one.
# TODO: honestly, while I currently only have one pc that can run local AI, might change in the future.
# And this config is getting a bit complicated for a single pc config
# Should be moved to it's own shit
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
ollama-cuda ollama-cuda
opencode
llama-cpp
llama-swap
]; ];
services.ollama = {
enable = true;
package = pkgs.ollama-cuda;
environmentVariables = {
OLLAMA_NUM_PARALLEL = "1";
OLLAMA_FLASH_ATTENTION = "1";
OLLAMA_KV_CACHE_TYPE = "q4_0";
OLLAMA_CONTEXT_LENGTH = "16384";
};
};
# Configure llama-swap as a systemd service
systemd.services.llama-swap = {
description = "llama-swap - OpenAI compatible proxy with automatic model swapping";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "laythe";
Group = "users";
# Point to your declarative config file
ExecStart = "${pkgs.llama-swap}/bin/llama-swap --config /etc/llama-swap/config.yaml --listen 0.0.0.0:9292 --watch-config";
Restart = "always";
RestartSec = 10;
# Environment for CUDA support
Environment = [
"PATH=/run/current-system/sw/bin"
"LD_LIBRARY_PATH=/run/opengl-driver/lib:/run/opengl-driver-32/lib"
];
};
};
# As long as this is here the models are declarative. llama-server will grab them if not downloaded already.
environment.etc."llama-swap/config.yaml".text = ''
models:
"Qwen3.5-35B-A3B-GGUF":
cmd: llama-server --port ''${PORT} -hf unsloth/Qwen3.5-35B-A3B-GGUF:Q4_K_S --ctx-size 128000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -np 1 --cpu-moe --fit-target 256 --ubatch-size 1024 -fa on --slots --slot-save-path /home/laythe/llamapcache --jinja -kvu --no-mmproj --swa-checkpoints 32
ttl: 2400
"Qwen3-1.7B-GGUF":
cmd: llama-server --port ''${PORT} -hf unsloth/Qwen3-1.7B-GGUF:Q4_K_S --ctx-size 32768 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu
ttl: 120
"Qwen3-8B-GGUF":
cmd: llama-server --port ''${PORT} -hf unsloth/Qwen3-8B-GGUF:Q4_K_S --ctx-size 32768 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1
ttl: 120
"Qwen3-4B-Claude-Opus-Distill":
cmd: llama-server --port ''${PORT} -hf TeichAI/Qwen3-4B-Thinking-2507-Claude-4.5-Opus-High-Reasoning-Distill-GGUF:Q4_K_M --ctx-size 32768 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256
ttl: 120
"Qwen3.5-9B-Thinking":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.5-9B-GGUF:Q4_K_M --ctx-size 32000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256 --chat-template-kwargs '{\"enable_thinking\": true}' --no-mmproj"
ttl: 120
"Qwen3.5-4B-Thinking":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.5-4B-GGUF:Q4_K_M --ctx-size 64000 --temp 0.6 --top-p 0.95 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256 --chat-template-kwargs '{\"enable_thinking\": true}'"
ttl: 120
"Qwen3.5-9B-Non-Thinking":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.5-9B-GGUF:Q4_K_M --ctx-size 32000 --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256 --no-mmproj"
ttl: 120
"Qwen3.5-4B-Non-Thinking":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.5-4B-GGUF:Q4_K_M --ctx-size 64000 --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256"
ttl: 120
"Qwen3.5-0.8B-Non-Thinking":
cmd: "llama-server --port ''${PORT} -hf unsloth/Qwen3.5-0.8B-GGUF:Q4_K_M --ctx-size 64000 --temp 0.7 --top-p 0.8 --top-k 20 --min-p 0.00 -fa on --jinja -kvu -np 1 --fit-target 256"
ttl: 120'';
# Set your time zone. # Set your time zone.
# time.timeZone = "Europe/Amsterdam"; # time.timeZone = "Europe/Amsterdam";
@@ -113,7 +184,7 @@
# networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether. # Or disable the firewall altogether.
# networking.firewall.enable = false; networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system # Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you # (/run/current-system/configuration.nix). This is useful in case you

View File

@@ -5,5 +5,6 @@
jami jami
element-desktop element-desktop
signal-desktop signal-desktop
praat
]; ];
} }

View File

@@ -2,19 +2,23 @@
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
antigravity # Free Gemini 3 credits was too good of an offer to not take up, even if it requires selling my soul. antigravity # Free Gemini 3 credits was too good of an offer to not take up, even if it requires selling my soul.
chromium
]; ];
home-manager.sharedModules = [ home-manager.sharedModules = [
({ pkgs, ... }: { (
programs.vscode = { { pkgs, ... }:
enable = true; {
extensions = with pkgs.vscode-extensions; [ programs.vscode = {
jnoortheen.nix-ide enable = true;
]; extensions = with pkgs.vscode-extensions; [
userSettings = { jnoortheen.nix-ide
"editor.formatOnSave" = true; ];
userSettings = {
"editor.formatOnSave" = true;
};
}; };
}; }
}) )
]; ];
} }

View File

@@ -1,7 +1,7 @@
{pkgs, ...}: { pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
kicad kicad
cura # cura
]; ];
} }

View File

@@ -1,4 +1,4 @@
{pkgs, environment, ...}: { pkgs, environment, ... }:
{ {
programs.steam = { programs.steam = {
enable = true; enable = true;
@@ -13,4 +13,4 @@
lutris lutris
prismlauncher prismlauncher
]; ];
} }

View File

@@ -9,6 +9,7 @@
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
kdePackages.kate kdePackages.kate
kdePackages.filelight
# kdePackages.kdeconnect-kde # kdePackages.kdeconnect-kde
]; ];

View File

@@ -1,4 +1,4 @@
{pkgs, ...}: { pkgs, ... }:
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
qemu qemu
@@ -6,7 +6,7 @@
]; ];
programs.virt-manager.enable = true; programs.virt-manager.enable = true;
users.groups.libvirtd.members = ["laythe"]; users.groups.libvirtd.members = [ "laythe" ];
virtualisation.libvirtd.enable = true; virtualisation.libvirtd.enable = true;
virtualisation.spiceUSBRedirection.enable = true; virtualisation.spiceUSBRedirection.enable = true;
virtualisation.libvirtd.qemu.swtpm.enable = true; virtualisation.libvirtd.qemu.swtpm.enable = true;
@@ -14,5 +14,6 @@
virtualisation.podman = { virtualisation.podman = {
enable = true; enable = true;
dockerCompat = true; dockerCompat = true;
enableNvidia = true;
}; };
} }