This commit is contained in:
jmarkin 2025-11-23 01:01:40 +03:00
parent c0197beb40
commit 48d6916ae9
18 changed files with 125 additions and 159 deletions

View file

@ -70,7 +70,8 @@
# secrets.url = "path:/projects/jmarkin/secrets";
secrets.inputs.nixpkgs.follows = "nixpkgs";
secrets.inputs.agenix.follows = "agenix";
# fix opengl
system-manager = {
url = "github:numtide/system-manager";
inputs.nixpkgs.follows = "nixpkgs";

View file

@ -1,4 +1,4 @@
{ pkgs, lib, config, ... }:
{ pkgs, config, ... }:
let
yek = pkgs.rustPlatform.buildRustPackage rec {
pname = "yek";
@ -92,12 +92,39 @@ rec {
}
];
}
{
type = "openai-compatible";
name = "openrouter";
api_base = "https://openrouter.ai/api/v1";
models = [
{
name = "kwaipilot/kat-coder-pro:free";
max_input_tokens = 256000;
supports_function_calling = true;
supports_vision = false;
}
{
name = "x-ai/grok-4.1-fast:free";
max_input_tokens = 256000;
supports_function_calling = true;
supports_vision = false;
}
{
name = "openai/gpt-oss-20b:free";
max_input_tokens = 256000;
supports_function_calling = true;
supports_vision = false;
}
{
name = "nomic-embed-text:latest";
type = "embedding";
default_chunk_size = 1000;
max_batch_size = 50;
}
];
}
];
};
home.sessionVariables = {
OLLAMA_URL = lib.mkDefault "http://192.168.88.15:11434";
};
}

View file

@ -1,50 +0,0 @@
{ pkgs, ... }:
{
home.sessionVariables = {
CRUSH_DISABLE_METRICS = 1;
CRUSH_DISABLE_PROVIDER_AUTO_UPDATE = 1;
};
# programs.crush = {
# enable = true;
# settings = {
# providers = {
# ollama = {
# name = "Ollama";
# base_url = "${home.sessionVariables.OLLAMA_URL}/v1/";
# type = "openai-compat";
# models = [
# {
# name = "Gemma3";
# id = "orieg/gemma3-tools:4b";
# default_max_tokens = "20000";
# }
# {
# name = "Qwen3-Coder";
# id = "danielsheep/Qwen3-Coder-30B-A3B-Instruct-1M-Unsloth:UD-IQ3_XXS";
# default_max_tokens = "20000";
# }
# {
# name = "GPT-OSS";
# id = "gpt-oss-safeguard:20b";
# default_max_tokens = "20000";
# }
# ];
# };
# };
# lsp = {
# go = { command = "gopls"; enabled = true; };
# nix = { command = "nixd"; enabled = true; };
# zuban = { command = "zuban"; enabled = true; };
# };
# options = {
# attribution = {
# co_authored_by = false;
# generated_with = false;
# };
# tui = { compact_mode = true; };
# debug = false;
# };
# };
# };
}

View file

@ -1,11 +1,18 @@
{ pkgs, ... }:
{ lib, pkgs, config, ... }:
{
home.sessionVariables = {
OLLAMA_HOST = "192.168.88.15";
OLLAMA_URL = "http://192.168.88.15:11434";
OLLAMA_HOST = lib.mkDefault "192.168.88.15";
OLLAMA_CONTEXT_LENGTH = "8192";
OLLAMA_PORT = "11434";
};
home.sessionVariables.OLLAMA_URL = lib.mkDefault "http://${config.home.sessionVariables.OLLAMA_HOST}:${config.home.sessionVariables.OLLAMA_PORT}";
imports = [
./aichat.nix
];
home.packages = with pkgs; [
ollama
];
}

View file

@ -13,6 +13,9 @@
"~/.config/alacritty/bamboo.toml"
];
};
env = {
WINIT_X11_SCALE_FACTOR = "1.0";
};
cursor = {
blink_interval = 500;
unfocused_hollow = false;

View file

@ -75,9 +75,7 @@
];
shellAliases = {
cat = "bat";
y = "yazi";
# grc = "cgrc";
grep = "rg";
jq = "jaq";
vim = "nvim";
v = "nvim";

View file

@ -137,7 +137,7 @@ client.background #ffffff
########################################################################
########################################################################
exec --no-startup-id "i3-msg 'workspace 1; exec $term'"
exec --no-startup-id "i3-msg 'workspace 1; exec Telegram'"
exec --no-startup-id "i3-msg 'workspace 2; exec zen-browser'"
########################################################################
@ -152,10 +152,11 @@ for_window [title="Calculator"] floating enable
for_window [title="Timer"] floating enable
for_window [class="^.*"] border pixel 1
for_window [class="librewolf"] border none
for_window [class="zen-browser"] border none
for_window [class="neovide"] border none
for_window [class="mpv"] floating enable
for_window [class="imv"] floating enable
for_window [class="zenity"] floating enable
for_window [class="Telegram.*"] floating enable
########################################################################
@ -166,6 +167,13 @@ for_window [class="zenity"] floating enable
########################################################################
########################################################################
bindsym XF86MonBrightnessUp exec "brightnessctl -d '*video*' s +10% && brightnessctl -d '*video*' g > /tmp/xobpipe"
bindsym XF86MonBrightnessDown exec "brightnessctl -d '*video*' s 10%- && brightnessctl -d '*video*' g > /tmp/xobpipe"
bindsym XF86AudioRaiseVolume exec "pamixer -ui 3 && pamixer --get-volume > /tmp/xobpipe"
bindsym XF86AudioLowerVolume exec "pamixer -ud 3 && pamixer --get-volume > /tmp/xobpipe"
# mute sound
bindsym XF86AudioMute exec "amixer sset Master toggle | sed -En '/\[on\]/ s/.*\[([0-9]+)%\].*/\1/ p; /\[off\]/ s/.*/0/p' | head -1 > /tmp/xobpipe"
## This will switch the current layout to the 'us'.
#bindsym $alt+l exec "setxkbmap -layout us && sleep 0.1 && setxkbmap -option grp:caps_toggle 'us,ru' -option grp_led:caps && sleep 0.1 && i3lock --blur 5"

View file

@ -2,8 +2,6 @@
let
xresources = pkgs.writeText "Xresources" ''
XTerm*termName: xterm-256color
XTerm*faceName: JetBrainsMonoNL Nerd Font Mono
XTerm*faceSize: 12
XTerm*title: XTerm
XTerm*loginShell: true
'';
@ -70,6 +68,7 @@ in
xdg-user-dirs
garcon
libxfce4ui
brightnessctl
xfce4-volumed-pulse
xfce4-power-manager
xfce4-notifyd

View file

@ -66,9 +66,7 @@ font-4 = FontAwesome5Brands:style=Solid:pixelsize=10;3
modules-left = i3 sp2 info-hackspeed sp2 temperature sp1 cpu sp1 memory
modules-center = xwindow
modules-right = wireless-network sp1 xkeyboard sp2 battery sp2 date sp2
tray-padding = 0
modules-right = wireless-network sp1 xkeyboard sp2 battery-alt sp2 date sp2 tray
wm-restack = i3
@ -184,6 +182,9 @@ type = internal/xkeyboard
[module/temperature]
type = internal/temperature
[module/tray]
type = internal/tray
; Full path of temperature sysfs path
; Use `sensors` to find preferred temperature source, then run
; $ for i in /sys/class/hwmon/hwmon*/temp*_input; do echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)"; done

76
home/programs/i3/polybar/scripts/battery.sh Normal file → Executable file
View file

@ -1,38 +1,50 @@
#!/usr/bin/bash
#!/usr/bin/env bash
# ───────────────────────────────────────────────────────────────────────────────
# battery_status.sh
#
# Uses only `bash` (≥4) and `acpi`
# Designed for Polybars `custom/script` module
# - Place in ~/.config/polybar/scripts/ and make executable
# ───────────────────────────────────────────────────────────────────────────────
# ------------------------------------------------------------------
# 1. Grab the “Battery X” line that contains the status info
# ------------------------------------------------------------------
battery_line=$(acpi 2>/dev/null | grep -E 'Battery [0-9]:' | head -n1)
# Getting the data and initializing an array.
BATTERY_INFO=($( acpi | awk -F',' '{ print $0 }'))
# bail out if acpi couldnt find a battery
[ -z "$battery_line" ] && exit 0
# Formatting helpers
CHARGE=$((${BATTERY_INFO[3]//%,}))
ICON=""
FORMAT=""
# ------------------------------------------------------------------
# 2. Parse the line
# ------------------------------------------------------------------
# Example line: "Battery 0: Discharging, 62%, 02:18:17 remaining"
# ──────> status ───≥ "Discharging"
# ──────> percent ───≥ "62"
# ──────> time ───≥ "02:18:17 remaining"
# Format battery icon, depending on the status.
if [[ "${BATTERY_INFO[2]}" == *"Charging"* ]]; then
ICON=" " # Plug icon, font awesome.
else
ICON=" " # Car Battery icon, font awesome
status=$(echo "$battery_line" | awk -F', ' '{print $1}' | awk -F': ' '{print $2}')
percent=$(echo "$battery_line" | awk -F', ' '{print $2}' | sed 's/%//')
time=$(echo "$battery_line" | awk -F', ' '{print $3}')
# ------------------------------------------------------------------
# 3. Pick a nice unicode icon
# ------------------------------------------------------------------
declare -A icons
icons=([Discharging]="💡" [Charging]="⚡" [Full]="🔋")
icon=${icons[$status]:-🟢}
# ------------------------------------------------------------------
# 4. Optional colour coding (red when battery < 20% and discharging)
# ------------------------------------------------------------------
color="-" # default white
if [[ $percent -le 20 && $status == "Discharging" ]]; then
color="#FF0000" # red
fi
if [[ $CHARGE -lt 10 ]]; then
# Red-ish
FORMAT="%{B#B33D43}%{F#fff} "
elif [[ $CHARGE -lt 30 ]]; then
# Orange-ish
FORMAT="%{B#F27F24}%{F#000} "
elif [[ $CHARGE -lt 60 ]]; then
# Yellow-ish
FORMAT="%{B#E5C167}%{F#000} "
elif [[ $CHARGE -lt 100 ]]; then
# Green-ish
FORMAT="%{B#6FB379}%{F#000} "
fi
# Format charge & color depending on the status.
FORMAT="$ICON$CHARGE"
# Final formatted output.
echo $FORMAT
# ------------------------------------------------------------------
# 5. Emit a single line that Polybar can display
# ------------------------------------------------------------------
# %{F…} ... %{F-} sets foreground colour
# The final "%{F-}" resets the colour so other modules arent affected
echo -e "%{F$color}${icon} ${percent}% ${time}%{F-}"

View file

@ -8,14 +8,14 @@
enable = true;
settings = {
neovim-bin = "${pkgs.nvim-pkg}/bin/nvim";
frame = "buttonless";
frame = "none";
grid = "300x60";
tabs = false;
fork = true;
font = {
normal = [ "JetBrainsMonoNL Nerd Font Mono" ];
size = 13;
size = 12;
};
};
};

View file

@ -1,8 +1,18 @@
{ config, pkgs, lib, ... }:
let
linuxSpecific = lib.mkIf pkgs.stdenv.isLinux {
home.packages = with pkgs;[
procps
inotify-tools
];
};
in
{
imports = [
linuxSpecific
../programs/git
../programs/bash.nix
../programs/tmux
@ -78,9 +88,5 @@
FZF_DEFAULT_OPTS = "--bind=shift-tab:up,tab:down";
LIBRARY_PATH = ''${lib.makeLibraryPath [pkgs.libiconv]}''${LIBRARY_PATH:+:$LIBRARY_PATH}'';
#OLLAMA_HOST = "192.168.88.15";
#OLLAMA_URL = "http://192.168.88.15:11434";
OLLAMA_CONTEXT_LENGTH = "8192";
OLLAMA_PORT = "11434";
};
}

View file

@ -40,7 +40,6 @@
universal-ctags
ptags
ollama
rustic
rclone

View file

@ -1,21 +0,0 @@
{ pkgs, ... }:
rec {
home.packages = with pkgs; [
# utils
procps
inotify-tools
];
imports = [
./kron.nix
# for config host
# ../programs/alacritty
];
home.sessionVariables.OLLAMA_HOST = "host.lima.internal";
home.sessionVariables.OLLAMA_URL = "http://${home.sessionVariables.OLLAMA_HOST}:${home.sessionVariables.OLLAMA_PORT}";
}

View file

@ -1,25 +1,21 @@
{ pkgs, lib, config, ... }:
{ pkgs, inputs, ... }:
{
home.packages = with pkgs; [
# utils
procps
inotify-tools
];
imports = [
./kron.nix
../programs/i3
../programs/ai
# for config host
# ../programs/ghostty
../programs/alacritty
../programs/neovide.nix
];
home.packages = with pkgs; [
telegram-desktop
];
home.sessionVariables.OLLAMA_HOST = lib.mkForce "192.168.88.15";
home.sessionVariables.OLLAMA_URL = lib.mkForce "http://${config.home.sessionVariables.OLLAMA_HOST}:11434";
}

View file

@ -3,12 +3,6 @@
{
home.packages = with pkgs; [
# utils
procps
inotify-tools
];
imports = [
./kron.nix
../programs/ai

View file

@ -2,11 +2,6 @@
{
home.packages = with pkgs; [
# utils
procps
inotify-tools
];
imports = [
./kron.nix

View file

@ -2,21 +2,12 @@
{
home.packages = with pkgs; [
# utils
procps
inotify-tools
];
imports = [
./kron.nix
../programs/ai
];
home.sessionVariables.OLLAMA_HOST = "192.168.88.15";
home.sessionVariables.OLLAMA_URL = "http://192.168.88.15:11434";
# go paths
home.sessionVariables.GOPATH = "/opt/go";
home.sessionVariables.GOCACHE = "/opt/go/.cache/go-build";