nixos-conf/home.nix
2026-03-22 22:16:01 +02:00

971 lines
25 KiB
Nix

{
inputs,
config,
pkgs,
lib,
...
}:
{
imports = [
./custom/hm
inputs.nix-flatpak.homeManagerModules.nix-flatpak
];
gtk = {
enable = true;
colorScheme = "dark";
theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
iconTheme = {
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
};
cursorTheme = {
name = "macOS";
package = pkgs.apple-cursor;
size = 28;
};
};
home = {
stateVersion = "25.11";
pointerCursor = {
enable = true;
gtk.enable = true;
x11 = {
enable = true;
# defaultCursor = "";
};
dotIcons.enable = true;
package = pkgs.apple-cursor;
name = "macOS";
size = 26;
};
shell = {
enableFishIntegration = true;
};
packages = with pkgs; [
### utility
dig
libnotify
arch-install-scripts
kdocker # tray the untrayable
xwayland-satellite
winboat
xfce4-taskmanager
xdg-desktop-portal-cosmic
file
### file management
cosmic-files
lxqt.lxqt-archiver
unrar
unzip
p7zip
### development
# idea-community-bin
sccache
### visuals
gnome-themes-extra
papirus-icon-theme
###
vlc
jq
gparted
tor-browser
iperf
sshuttle
nautilus
### social
# fluffychat
### gaming
winetricks
wineWow64Packages.full
heroic
vintagestory
prismlauncher
# bottles # sunthetik2 mouse issues
# umu-launcher
### neural networks
dsearch
lmstudio
# vllm
claude-code
# kdePackages.kdenlive
(python313.withPackages (
py: with py; [
huggingface-hub
# haystack-ai
# raganything
]
))
]
# anything-llm
# ]
;
### NEVER USE THIS GARBAGE
# flowblade pitivi koboldcpp
sessionVariables = {
DESKTOP = ":0";
OLLAMA_HOST = "127.0.0.1:11434";
SCCACHE_DIR = "${config.home.homeDirectory}/.cache/sccache";
SCCACHE_SERVER_UDS = "${config.home.homeDirectory}/.cache/sccache/server.sock";
};
sessionVariablesExtra = ''
if [ -r /run/agenix/openrouter-open.key.age ]; then
export \
OPENROUTER_API_KEY="$(cat /run/agenix/openrouter-open.key.age)" \
OPENROUTER_BASE_URL="https://openrouter.ai/api"
# anthropic api
export \
ANTHROPIC_BASE_URL="$OPENROUTER_BASE_URL" \
ANTHROPIC_API_KEY="" \
ANTHROPIC_AUTH_TOKEN="$OPENROUTER_API_KEY" \
ANTHROPIC_MODEL="openrouter/free"
# openai api
# export \
# OPENAI_API_BASE="$OPENROUTER_BASE_URL" \
# OPENAI_API_KEY="$OPENROUTER_API_KEY"
fi
'';
file = {
".config/waybar/power_menu.xml".text = ''
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkMenu" id="menu">
<child>
<object class="GtkMenuItem" id="shutdown">
<property name="label"> Shutdown</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="reboot">
<property name="label"> Reboot</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="suspend">
<property name="label"> Suspend</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="hibernate">
<property name="label"> Hibernate</property>
</object>
</child>
</object>
</interface>
'';
};
sessionPath = [ "/run/wrappers/bin" ];
};
xdg = {
configFile."xfce4/helpers.rc".text = ''
TerminalEmulator=wezterm
'';
mimeApps = {
enable = true;
defaultApplications = {
"text/html" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/tg" = "org.telegram.desktop.desktop";
"x-scheme-handler/discord" = "vesktop.desktop";
"image/jpeg" = "swayimg.desktop";
"image/png" = "swayimg.desktop";
"image/webp" = "swayimg.desktop";
"application/zip" = "lxqt-archiver.desktop";
};
};
portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-wlr
xdg-desktop-portal-gnome
xdg-desktop-portal-cosmic
];
config = {
common = {
default = [
"gtk"
];
"org.freedesktop.impl.portal.FileChooser" = "gnome";
"org.freedesktop.impl.portal.ScreenCast" = "gnome";
};
};
};
configFile."obsidian/.keep".text = "";
};
systemd.user = {
startServices = "sd-switch";
services = {
sccache = {
Unit = {
Description = "User sccache server";
};
Service = {
Environment = [
"SCCACHE_DIR=${config.home.homeDirectory}/.cache/sccache"
"SCCACHE_SERVER_UDS=${config.home.homeDirectory}/.cache/sccache/server.sock"
"SCCACHE_START_SERVER=1"
"SCCACHE_NO_DAEMON=1"
"SCCACHE_IDLE_TIMEOUT=0"
];
ExecStartPre = [
"${pkgs.coreutils}/bin/mkdir -p ${config.home.homeDirectory}/.cache/sccache"
"${pkgs.coreutils}/bin/rm -f ${config.home.homeDirectory}/.cache/sccache/server.sock"
];
ExecStart = "${pkgs.sccache}/bin/sccache";
Restart = "always";
RestartSec = 2;
};
Install = {
WantedBy = [ "default.target" ];
};
};
prepare2watch = {
Unit = {
Description = "prepare videos to get later";
};
Service = {
Type = "oneshot";
WorkingDirectory = "${config.home.homeDirectory}/Downloads/1/";
ExecStart = ''
${pkgs.coreutils-full}/bin/stdbuf -oL -eL ${pkgs.util-linux}/bin/flock -n %t/prepare2watch.lock ${pkgs.fish}/bin/fish ./prepare2watch.fish
'';
};
};
};
paths = {
prepare2watch = {
Unit = {
Description = "Watch ${config.home.homeDirectory}/Downloads/1/list";
};
Path = {
PathChanged = "${config.home.homeDirectory}/Downloads/1/list";
PathModified = "${config.home.homeDirectory}/Downloads/1/list";
Unit = "prepare2watch.service";
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
};
services = {
flatpak = {
packages = [
"org.vinegarhq.Sober"
];
};
mako.enable = true;
ollama = {
enable = true;
package = pkgs.ollama-vulkan;
host = "127.0.0.1";
environmentVariables = {
OLLAMA_MAX_LOADED_MODELS = "1";
OLLAMA_NUM_PARALLEL = "1";
OLLAMA_FLASH_ATTENTION = "1";
OLLAMA_KV_CACHE_TYPE = "q8_0";
# OLLAMA_CONTEXT_LENGTH = "16000";
OLLAMA_MODELS = "/home/thek0tyara/Downloads/llm/ollama";
XDG_DATA_DIRS = "empty";
};
};
podman = {
enable = true;
};
polkit-gnome.enable = true;
qdrant = {
enable = true;
dataDir = "/mnt/HDD_A_DATA/services/lib/qdrant";
settings = {
storage = {
hnsw_index = {
on_disk = true;
};
};
service = {
host = "127.0.0.1";
http_port = 6333;
grpc_port = 6334;
};
telemetry_disabled = true;
};
};
swayidle = {
enable = true;
timeouts = [
{
timeout = 601;
command = "${pkgs.niri}/bin/niri msg action power-off-monitors";
}
{
timeout = 600;
command = "${pkgs.swaylock}/bin/swaylock -f --color 030303";
}
];
events = {
"before-sleep" = "${pkgs.swaylock}/bin/swaylock -fF --color 030303";
"lock" = "lock";
};
};
};
programs = {
### custom
n8n = {
# enable = true;
settings = {
N8N_HOST = "127.0.0.1";
N8N_PORT = 5678;
N8N_PROTOCOL = "http";
};
# environmentFile = ~/.config/n8n/secrets.env;
# extraArgs = [ ];
};
llama-cpp = {
enable = true;
package = pkgs.llama-cpp.override {
vulkanSupport = true;
rpcSupport = true;
};
defaultArgs = [
"--host"
"127.0.0.1"
"--port"
"8080"
"--jinja"
"-fa"
"on"
];
# eosStrings = [ "<|im_end|>" ];
presets = [
{
name = "codegeex4";
path = "/home/thek0tyara/Downloads/llm/codegeex4-all-9b.Q8_0.gguf";
eosStrings = [ "<|im_end|>" ];
}
];
};
opencode = {
enable = true;
settings = {
compaction = {
auto = true;
prune = true;
};
watcher = {
ignore = [
".git/**"
];
};
plugin = [
"@zenobius/opencode-skillful" # lazy load
];
default_agent = "plan";
tools = {
skill = false;
"qdrant_*" = false;
};
mcp = {
qdrant = {
type = "local";
command = [
"${pkgs.uv}/bin/uvx"
"-qq"
"mcp-server-qdrant"
];
enabled = true;
timeout = 15000;
environment = {
# NumPy from uvx needs libstdc++.so.6 on NixOS.
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.stdenv.cc.cc ];
QDRANT_URL = "http://127.0.0.1:6333";
COLLECTION_NAME = "opencode_memory";
# Debug only:
# FASTMCP_LOG_LEVEL = "DEBUG";
# FASTMCP_DEBUG = "true";
};
};
};
# Agents: features retained, but only injected when invoked
agent = {
plan = {
mode = "primary";
tools = {
write = false;
edit = false;
bash = false;
skill = false;
"qdrant_*" = false;
};
};
build = {
mode = "primary";
tools = {
write = true;
edit = true;
bash = true;
skill = false;
"qdrant_*" = false;
};
};
memory = {
mode = "subagent";
description = "Opt-in semantic memory via Qdrant MCP";
tools = {
"qdrant_*" = true;
};
};
skills = {
mode = "subagent";
description = "Opt-in skills tool";
tools = {
skill = true;
};
};
};
theme = "opencode";
autoupdate = false;
share = "manual";
model = "openrouter/openrouter/free";
# server = {
# port = 4096;
# hostname = "127.0.0.1";
# };
provider = {
"openrouter" = {
# npm = "@ai-sdk/openai-compatible";
# name = "openrouter/free";
# options = {
# baseURL = "https://openrouter.ai/api/v1";
# };
models = {
"openrouter/free" = {
};
};
};
"ollama" = {
npm = "@ai-sdk/openai-compatible";
name = "Ollama (local)";
options = {
baseURL = "http://127.0.0.1:11434/v1";
};
models = {
"qwen2.5-coder:7b" = {
name = "qwen2.5-coder";
};
"qwen3:8b" = {
name = "qwen3";
};
};
};
};
};
rules = ''
# Global rules (thin)
- Prefer on-demand file loading over preloading large docs.
- Use MCP/skills only via dedicated subagents.
'';
};
### default
aria2.enable = true;
btop.enable = true;
codex = {
enable = true;
settings = {
model = "gpt-5.4";
approval_policy = "on-request";
model_reasoning_effort = "high";
#
# model_provider = "openrouter";
# model_providers = {
# };
};
};
# command-not-found.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
element-desktop = {
enable = true;
settings = {
};
};
eza = {
enable = true;
git = true;
icons = "auto";
};
fastfetch.enable = true;
firefox = {
enable = true;
package = pkgs.firefox;
languagePacks = [ "en-US" ];
};
fish = {
enable = true;
functions = {
fish_greeting = "";
nix-cleanup = ''
sudo nix-collect-garbage --delete-older-than 30d && \
sudo nix-store --optimise
'';
xdg-fix = ''
systemctl --user restart 'xdg-desktop-portal*'
'';
kernel-driver-audit = ''
nix-shell -p usbutils.out --run 'outfile="$HOME/kernel-driver-audit-$(hostname)-$(date +%F-%H%M%S).txt"; {
echo \'=== uname -a ===\'; uname -a
echo
echo \'=== lspci -nnk ===\'; lspci -nnk
echo
echo \'=== lsusb ===\'; lsusb
echo
echo \'=== lsusb -t ===\'; lsusb -t
echo
echo \'=== lsmod ===\'; lsmod
echo
echo \'=== /proc/cmdline ===\'; cat /proc/cmdline
echo
echo \'=== /sys/module (loaded module names) ===\'; ls /sys/module | sort
} > "$outfile"; echo "$outfile"'
'';
# openrouter-env = '' # later
# set -g OPENROUTER_API="$(cat ${config.age.secrets."openrouter-open".path})"
# exec "$@"
# '';
};
};
lutris = {
# enable = true;
# defaultWinePackage = pkgs.wineWowPackages.full;
runners = {
wine = {
settings = {
runner = {
# runner_executable = "${pkgs.wineWowPackages.full}/bin/wine";
};
system = {
game_path = "/home/thek0tyara/Documents/games/lutris";
disable_runtime = false;
prefer_system_libs = true;
};
};
};
};
};
# nheko.enable = true;
niri = {
package = pkgs.niri;
settings = {
prefer-no-csd = true;
hotkey-overlay.skip-at-startup = true;
screenshot-path = "~/Pictures/Screenshots/%Y-%m-%d_%H-%M-%S.png";
input = {
keyboard = {
xkb = {
layout = "us,ru";
options = "grp:alt_shift_toggle";
};
numlock = true;
};
mod-key = "Super";
};
layout.default-column-width = { };
spawn-at-startup = [
{
sh = "systemctl --user restart xdg-desktop-portal xdg-desktop-portal-wlr xdg-desktop-portal-gtk";
}
];
workspaces = {
"1-social" = {
name = "social";
};
"2-browsing" = {
name = "browsing";
};
"3-terminal" = {
name = "terminal";
};
"4-gaming" = {
name = "gaming";
};
};
window-rules = [
{
matches = [
{ app-id = "org.telegram.desktop"; }
];
default-column-width = {
fixed = 720;
};
open-on-workspace = "social";
# block-out-from = "screen-capture";
}
{
matches = [
{ app-id = "discord"; }
{ app-id = "vesktop"; }
];
default-column-width = {
fixed = 1150;
};
open-on-workspace = "social";
}
{
matches = [
{ app-id = "firefox"; }
];
default-column-width = {
fixed = 1888;
};
# match is-floating = false;
# tiled-state = false;
# open-maximized-to-edges = true;
open-on-workspace = "browsing";
}
# "terminal".matches = {
# app-id = "Terminal|com.mitchellh.ghostty|opensnitch-ui";
# open-on-workspace = "terminal";
# }
{
matches = [
{ app-id = "steam"; }
];
# tiled-state = false;
open-on-workspace = "gaming";
}
{
matches = [
{
app-id = "steam";
title = "^notificationtoasts_[0-9]*_desktop$";
}
];
# open-floating = false;
default-floating-position = {
x = 0;
y = 20;
relative-to="top-left";
};
open-floating = true;
open-on-workspace = "gaming";
}
{
matches = [
{ title = "^Picture-in-Picture$"; }
{ app-id = "xdg-desktop-portal-gtk"; }
];
open-floating = true;
}
];
binds = {
"Mod+T".action.spawn = [
# open terminal
"wezterm-gui"
"start"
"--always-new-process"
];
"Mod+R".action.spawn = "fuzzel";
"Mod+Shift+L".action.spawn = [
"swaylock"
"--color"
"030303"
];
"Scroll_Lock" = {
# toggle microphone
allow-when-locked = true;
action.spawn = [
"${pkgs.wireplumber}/bin/wpctl"
"set-mute"
"@DEFAULT_AUDIO_SOURCE@"
"toggle"
];
};
"Print".action."screenshot" = { };
"Mod+Q".action."close-window" = { };
"Mod+V".action."toggle-window-floating" = { };
"Mod+F".action."fullscreen-window" = { };
"Mod+Shift+F".action."expand-column-to-available-width" = { };
"Mod+C".action.center-column = { };
"Mod+Ctrl+C".action.center-visible-columns = { };
"Mod+Minus".action = {
set-column-width = "-10%";
};
"Mod+Equal".action = {
set-column-width = "+10%";
};
"Mod+Shift+Minus".action = {
set-window-height = "-10%";
};
"Mod+Shift+Equal".action = {
set-window-height = "+10%";
};
"Mod+WheelScrollUp".action.focus-column-left = { };
"Mod+WheelScrollDown".action.focus-column-right = { };
"Mod+Left".action.focus-column-left = { };
"Mod+Right".action.focus-column-right = { };
"Mod+Up".action.focus-window-up = { };
"Mod+Down".action.focus-window-down = { };
"Mod+Shift+Up".action.move-window-up = { };
"Mod+Shift+Down".action.move-window-down = { };
"Mod+Shift+Left".action.move-column-left = { };
"Mod+Shift+Right".action.move-column-right = { };
"Mod+Home".action.focus-column-first = { };
"Mod+End".action.focus-column-last = { };
"Mod+Shift+Home".action.move-column-to-first = { };
"Mod+Shift+End".action.move-column-to-last = { };
"Mod+Shift+Page_Down".action.move-workspace-down = { };
"Mod+Shift+Page_Up".action.move-workspace-up = { };
"Mod+Shift+WheelScrollUp".action.focus-workspace-up = { };
"Mod+Shift+WheelScrollDown".action.focus-workspace-down = { };
"Mod+M".action.quit = { };
"Mod+Shift+P".action.power-off-monitors = { };
}
# (switch|move) to workspace by number
// (builtins.listToAttrs (
builtins.concatMap
(
i:
let
ws = if i == 0 then 10 else i;
in
[
{
name = "Mod+${toString i}";
value.action.focus-workspace = ws;
}
{
name = "Mod+Shift+${toString i}";
value.action.move-column-to-workspace = ws;
}
]
)
[
1
2
3
4
5
6
7
8
9
0
]
));
};
};
nix-index.enable = true;
nix-your-shell.enable = true;
obs-studio = {
enable = true;
plugins = with pkgs.obs-studio-plugins; [
wlrobs
obs-pipewire-audio-capture
];
};
obsidian.enable = true;
starship.enable = true;
swayimg.enable = true;
swaylock.enable = true;
uv = {
enable = true; # TODO move to nativeBuildInputs of needing
settings = {
python-downloads = "never";
python-preference = "only-system";
# pip.index-url = "https://pypi.org/simple";
};
};
vesktop = {
enable = true;
# package = vesktopNoFuses;
# settings = { TODO };
};
vscode = {
enable = true;
package = pkgs.vscode;
};
waybar = {
enable = true;
settings = {
mainBar = {
modules-left = [
"niri/workspaces"
];
modules-center = [ "niri/window" ];
modules-right = [
"idle_inhibitor"
"pulseaudio"
"network"
"cpu"
"memory"
"temperature"
"niri/language"
"clock"
"tray"
"custom/power"
];
"idle_inhibitor" = {
"format" = "{icon}";
"format-icons" = {
"activated" = "";
"deactivated" = "";
};
};
"pulseaudio" = {
# "scroll-step" = 1; # %, can be a float
"format" = "{volume}% {icon} {format_source}";
"format-bluetooth" = "{volume}% {icon} {format_source}";
"format-bluetooth-muted" = " {icon} {format_source}";
"format-muted" = " {format_source}";
"format-source" = "{volume}% ";
"format-source-muted" = "";
"format-icons" = {
"headphone" = "";
"hands-free" = "";
"headset" = "";
"phone" = "";
"portable" = "";
"car" = "";
"default" = [
""
""
""
];
};
"on-click" = "pavucontrol";
};
"network" = {
"format-wifi" = "{essid} ({signalStrength}%) ";
"format-ethernet" = "{ipaddr}/{cidr} ";
"tooltip-format" = "{ifname} via {gwaddr} ";
"format-linked" = "{ifname} (No IP) ";
"format-disconnected" = "Disconnected ";
"format-alt" = "{ifname}: {ipaddr}/{cidr}";
};
"cpu" = {
"format" = "{usage}% ";
# "tooltip" = false;
};
"memory" = {
"format" = "{}% ";
};
"temperature" = {
# "thermal-zone" = 2;
# "hwmon-path" = "/sys/class/hwmon/hwmon2/temp1_input";
"critical-threshold" = 80;
# "format-critical" = "{temperatureC}°C {icon}";
"format" = "{temperatureC}°C {icon}";
"format-icons" = [
""
""
""
];
};
"clock" = {
# "timezone" = "America/New_York";
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
"format-alt" = "{:%Y-%m-%d}";
};
"tray" = {
# "icon-size" = 21;
"spacing" = 10;
};
"custom/power" = {
"format" = " ";
"tooltip" = false;
"menu" = "on-click";
"menu-file" = "$HOME/.config/waybar/power_menu.xml"; # Menu file in resources folder
"menu-actions" = {
"shutdown" = "shutdown";
"reboot" = "reboot";
"suspend" = "systemctl suspend";
"hibernate" = "systemctl hibernate";
};
};
};
};
};
wezterm = {
enable = true;
extraConfig = ''
local wezterm = require 'wezterm'
keys = { { key = 'F', mods = 'CTRL|SHIFT', action = wezterm.action.Search({ CaseInSensitiveString = "" }) } }
local config = wezterm.config_builder()
config.default_prog = { "fish", "--login" --, "-c", "tmux attach -t dev || tmux new -s dev"
}
config.color_scheme = "Ayu Dark"
config.hide_tab_bar_if_only_one_tab = true
return config
'';
};
yt-dlp = {
enable = true;
package = pkgs.yt-dlp;
settings = {
embed-thumbnail = true;
downloader = "aria2c";
};
# extraConfig = ''
# --extractor-args "youtube:player_client=default,ios,-android_sdkless"
# '';
};
zed-editor = {
# enable = true;
themes = {
"name" = "Ayu Dark";
};
};
};
}