nix config

This commit is contained in:
thek4n 2026-08-04 01:46:04 +03:00
parent c36e5e012b
commit e1b1fe490c
4 changed files with 23 additions and 261 deletions

View File

@ -13,7 +13,7 @@
boot.loader.grub.useOSProber = true; boot.loader.grub.useOSProber = true;
# Установка имени хоста # Установка имени хоста
networking.hostName = "thek4n.ru"; networking.hostName = "thek4n.local";
# Использование NetworkManager # Использование NetworkManager
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
@ -38,13 +38,22 @@
services.openssh.enable = true; services.openssh.enable = true;
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd sway";
user = "greeter";
};
};
};
users.user."thek4n" = { users.user."thek4n" = {
isNormalUser = true; isNormalUser = true;
description = "thek4n"; description = "thek4n";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [ "networkmanager" "wheel" ];
# Установка пользовательских пакетов # Установка пользовательских пакетов
packages = with pkgs; [ packages = with pkgs; [
# thunderbird
]; ];
}; };
@ -77,28 +86,22 @@
lesspipe lesspipe
mpv mpv
socat socat
npm
ctags ctags
glow glow
tree-sitter tree-sitter
tree-sitter-cli
highlight highlight
ttf-joypixels noto-fonts
noto-fonts-emoji
ueberzug ueberzug
poppler poppler
yazi yazi
ffmpeg ffmpeg
7zip p7zip
jq
fd
ripgrep ripgrep
zoxide
resvg resvg
imagemagick imagemagick
alacritty
]; ];
# Активация модуля nixos, устанавливает программу и конфиги для нее
programs.firefox.enable = true; programs.firefox.enable = true;
programs.neovim = { programs.neovim = {
@ -112,66 +115,18 @@
enabled = true; enabled = true;
userName = "thek4n"; userName = "thek4n";
userEmail = "thek4n@yandex.ru"; userEmail = "thek4n@yandex.ru";
aliases = {
a = "!ga";
u = "!git diff --name-only --cached | fzf -1 -0 -m --bind load:last --preview 'git diff --staged --color=always {1}' | xargs -r git restore --staged";
msg = "log -1 --pretty=%B";
d = "diff";
di = "diff";
ds = "diff --staged";
dno = "diff --name-only";
dw = "diff --word-diff=color";
sw = "switch";
swl = "switch -";
swb = "switch -c";
swc = "switch -c";
co = "checkout";
col = "checkout @{-1}";
cob = "checkout -b";
ci = "commit";
cia = "commit --all";
amend = "commit --amend --no-edit";
amenda = "commit --all --amend --no-edit";
fuck = "commit --amend";
uncommit = "reset --soft HEAD~1";
untrack = "rm --cache --";
cim = "!_m() { git commit -m \"$*\"; }; _m";
cima = "!_m() { git commit -am \"$*\"; }; _m";
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)";
pst = "!git push origin --tags";
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)";
pr = "pull --rebase";
s = "status";
st = "status";
br = "branch";
bm = "branch --merged";
bn = "branch --no-merged";
hist = "log --pretty=format:'%Cgreen%h %Creset%cd %Cblue[%cn](%G?) %Creset%s%C(yellow)%d%C(reset)' --graph --date=relative --decorate --color=always";
history = "hist --all";
hs = "hist -n 10";
hsa = "hist -n 10 --all";
last = "log -1 HEAD";
lastd = "diff HEAD^ HEAD";
today = "hist --since=midnight";
df = "!_m() { git log --pretty=format:'%h %cd [%cn] %s%d' --date=relative | fzf --bind \"enter:execute(git diff --color=always $@ {1}^ {1} | ${PAGER})\" --preview-window=65% --preview=\"git diff --color=always $@ {1}^ {1}\"; }; _m";
type = "cat-file -t";
dump = "cat-file -p";
unstage = "reset HEAD --";
count = "rev-list --count --all";
tags = "for-each-ref --sort=-creatordate --format '%(refname:strip=2)' refs/tags";
initci = "commit --allow-empty -m 'Initial commit'";
# edit conflicted file on merge
edit-unmerged = "!$EDITOR $(git ls-files --unmerged | cut -f2 | sort -u)";
# add conflicted file on merge
add-unmerged = "!git add $(git ls-files --unmerged | cut -f2 | sort -u)";
remove-remote-tag = "!f() { git tag -d $1 && git push origin :refs/tags/$1 }; f";
aliases = "!git config -l | grep '^alias\\.' | cut -d. -f2-";
# git clone git://localhost/
serve = "daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/";
}; };
programs.sway = {
enable = true;
};
environment.etc."sway/config" = {
text = ''
set $mod Mod4
set $term alacritty
bindsym $mod+Return exec $term'';
}; };
# Указание версии NixOs # Указание версии NixOs

View File

@ -1,60 +0,0 @@
separator_block_width=15
markup=pango
color=#FFFFFF
interval=5
[wireless]
command=~/.config/i3blocks/scripts/builder.sh wireless
interval=10
[diskroot]
command=~/.config/i3blocks/scripts/builder.sh disk_root
interval=30
[diskhome]
command=~/.config/i3blocks/scripts/builder.sh disk_home
interval=30
[memory]
command=~/.config/i3blocks/scripts/builder.sh memory
interval=5
[cpu_usage]
command=~/.config/i3blocks/scripts/builder.sh cpu_usage
interval=5
[cpu_temp]
command=~/.config/i3blocks/scripts/builder.sh cpu_temp
interval=5
[bluetooth]
command=~/.config/i3blocks/scripts/builder.sh bluetooth_battery
interval=5
[volume]
command=~/.config/i3blocks/scripts/builder.sh volume
interval=1
signal=1
[pomodoro]
command=~/.config/i3blocks/scripts/builder.sh pomodoro
interval=1
signal=2
[language]
command=~/.config/i3blocks/scripts/builder.sh language
signal=1
[userhost]
command=~/.config/i3blocks/scripts/builder.sh userhost
signal=1
[battery]
command=~/.config/i3blocks/scripts/builder.sh battery
interval=30
[time]
command=~/.config/i3blocks/scripts/builder.sh time
interval=30

View File

@ -1,125 +0,0 @@
#!/bin/sh
set -ue
readonly EXIT_SUCCESS=0
readonly EXIT_FAILURE=1
cmd_wireless() {
wifiname="$(LANG=C nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2)"
wifi_ip=$(ip -o -4 addr show | grep wlp | awk '{print $4}' | cut -d/ -f1 | head -1)
if [ -z "${wifiname}" ] || [ -z "${wifi_ip}" ]; then
return 0
fi
printf ' %s %s\n' "${wifiname}" "${wifi_ip}"
}
cmd_battery() {
charging_status="$(cat /sys/class/power_supply/BAT0/status)"
percent="$(cat /sys/class/power_supply/BAT0/capacity)"
if [ "${percent}" -lt 35 ]; then
emoji_status="🪫"
else
emoji_status="🔋"
fi
if [ "${charging_status}" = "Charging" ]; then
emoji_status="🔌"
fi
printf "%s %s%%\n" "${emoji_status}" "${percent}"
}
cmd_disk_root() {
df -h / | awk '/\// {print "/ "$3"/"$2}'
}
cmd_disk_home() {
res="$(df -h /home)"
if [ "$(echo "${res}" | awk '/\// {print $6}')" = "/" ]; then
return 1
fi
df -h /home | awk '/\// {print " "$3"/"$2}'
}
cmd_memory() {
free -h | awk '/^Mem/ {print "🎟 "$3"/"$2}' | sed 's/i//g'
}
cmd_cpu_usage() {
top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print " "100 - $1"%"}'
}
cmd_cpu_temp() {
temp_mC="$(cat /sys/class/thermal/thermal_zone0/temp)"
temp_C="$((temp_mC / 1000))"
if [ "${temp_C}" -gt 80 ]; then
printf '<span foreground="red"> %s°C</span>\n' "${temp_C}"
else
printf ' %s°C\n' "${temp_C}"
fi
}
cmd_time() {
LC_ALL=C date '+ %d.%m.%y %a  %H:%M'
}
cmd_volume() {
value="$(pactl --format=json get-sink-volume @DEFAULT_SINK@ | jq --raw-output '.volume."front-left".value_percent')"
printf ' %s\n' "${value}"
}
cmd_pomodoro() {
pomodoro get
}
cmd_bluetooth_battery() {
device="$(upower -e | grep headset | head -1)"
upower -i "${device}" | grep percentage | awk '{ print "🎧"$2"" }'
}
cmd_language() {
layout="$(swaymsg -t get_inputs | jq -r '.[] | select(.type == "keyboard") | .xkb_active_layout_name' | head -1)"
case "${layout}" in
"English (US)")
printf '🇬🇧 En\n'
;;
Russian)
printf '🇷🇺 Ru\n'
;;
*)
printf '🌐 %s\n' "${layout}"
;;
esac
}
cmd_userhost() {
printf "%s@%s\n" "${USER}" "${HOST:-${HOSTNAME:-}}"
}
case "${1}" in
wireless) shift; cmd_wireless "$@" ;;
ethernet) shift; cmd_ethernet "$@" ;;
battery) shift; cmd_battery "$@" ;;
disk_root) shift; cmd_disk_root "$@" ;;
disk_home) shift; cmd_disk_home "$@" ;;
memory) shift; cmd_memory "$@" ;;
cpu_usage) shift; cmd_cpu_usage "$@" ;;
cpu_temp) shift; cmd_cpu_temp "$@" ;;
time) shift; cmd_time "$@" ;;
volume) shift; cmd_volume "$@" ;;
pomodoro) shift; cmd_pomodoro "$@" ;;
bluetooth_battery) shift; cmd_bluetooth_battery "$@" ;;
language) shift; cmd_language "$@" ;;
userhost) shift; cmd_userhost "$@" ;;
*) exit "${EXIT_FAILURE}" ;;
esac
exit "${EXIT_SUCCESS}"

View File

@ -1,8 +0,0 @@
#!/bin/sh
swaymsg -m -t SUBSCRIBE "['input']" | \
jq --unbuffered -r '.change' | while read -r line; do
if echo "${line}" | grep -q "xkb_layout"; then
pkill -RTMIN+1 i3blocks
fi
done