nix-config/home/server.nix

129 lines
3.4 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";
# Expose pi only; do not add the whole npm global bin (which also contains pi-web).
home.sessionPath = [
"${config.home.homeDirectory}/.local/bin"
];
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
# Nix
alejandra # форматтер
nix-output-monitor
# Утилиты
delta # красивый git diff
trash-cli # rm с корзиной
];
# --- 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'
'';
};
}