nix-config/home/server.nix

157 lines
4.3 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.

# Минимальный home-manager для headless NixOS-серверов (heather и будущие).
# Не тянет десктопный мусор: ollama (~GB), texliveFull (~4GB), kitty, syncthing,
# pass-with-extensions, duti (macOS), pnpm, gita и т.д.
# Цель — лёгкий образ и быстрый rebuild. Только то, что нужно админу на сервере.
{ config, pkgs, ... }:
{
home.stateVersion = "25.11";
# User-level tools installed outside Nix (PinchTab, pi wrapper, etc.).
home.sessionPath = [
"${config.home.homeDirectory}/.local/bin"
"${config.home.homeDirectory}/.local/libexec"
];
# Keep the browser control plane alive across SSH logout and reboots.
# PinchTab itself is installed outside Nix because its upstream release
# binary is dynamically linked; the local NixOS-compatible build lives in
# ~/.local/libexec/pinchtab.
systemd.user.services.pinchtab = {
Unit = {
Description = "PinchTab browser control plane";
After = [ "dbus-broker.service" ];
};
Service = {
ExecStart = "%h/.local/libexec/pinchtab server";
Restart = "on-failure";
RestartSec = 5;
Environment = [
"HOME=%h"
"PATH=/run/current-system/sw/bin:/home/mikl/.npm-global/bin:/home/mikl/.local/bin:/home/mikl/.local/libexec"
];
};
Install = {
WantedBy = [ "default.target" ];
};
};
home.file.".local/bin/pi" = {
executable = true;
text = ''
#!/bin/sh
exec "$HOME/.npm-global/bin/pi" "$@"
'';
};
# --- Пакеты: минимальный админский набор ---
home.packages = with pkgs; [
# Навигация/поиск
eza
bat
ripgrep
fd
fzf
tree
# Системное
htop
tmux
# Редактор
vim
# Git
git
tea # Forgejo/Gitea CLI
# Nix
alejandra # форматтер
nix-output-monitor
# Утилиты
delta # красивый git diff
trash-cli # rm с корзиной
# x402 / MPP agentic payments CLI (Solana Foundation)
(pkgs.callPackage ./pay.nix {})
];
# --- FZF ---
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "fd --type f --hidden --exclude .git";
defaultOptions = [ "--height 40%" "--layout=reverse" "--border" ];
};
# --- Zoxide ---
programs.zoxide = {
enable = true;
enableZshIntegration = true;
options = [ "--cmd cd" ];
};
# --- Bat ---
programs.bat = {
enable = true;
config = {
theme = "Catppuccin Macchiato";
italic-text = "always";
style = "numbers,changes,header";
};
};
# --- Eza ---
programs.eza = {
enable = true;
icons = "auto";
git = true;
};
# --- Git: сервер-минимум. Без SHA-signing/GPG (gpg агента на сервере нет),
# с pull.rebase для чистой истории при правках прямо на хосте. ---
programs.git = {
enable = true;
userName = "mikl";
userEmail = "mikl@iscg.dev";
settings = {
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
# credential helper: токены для forgejo хранятся в ~/.git-credentials
# (plaintext, chmod 600, ВНЕ git/nix — см. infra notes). Нужен для
# git clone https://git.iscg.dev/mikl/<repo> (ssh deploy key только на
# nix-config; для memory/pass/etc используем https + token).
credential.helper = "store";
};
};
programs.delta = {
enable = true;
enableGitIntegration = true;
};
# --- Zsh: минимульный, без pure-prompt и fastfetch (это десктоп-флёр) ---
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
history = {
size = 10000;
save = 10000;
ignoreDups = true;
share = true;
};
shellAliases = {
ll = "eza -l --icons --git";
la = "eza -la --icons --git";
};
initContent = ''
# Простой промпт для headless: user@host:path$
autoload -U colors && colors
PROMPT='%F{green}%n@%m%f:%F{blue}%~%f$ '
RPROMPT='%F{240}%D{%H:%M}%f'
'';
};
}