Compare commits

...

4 Commits

Author SHA1 Message Date
03cea9482a fix(nix): zsh plugin 2026-08-13 00:59:04 +03:00
58aadf500a add flake lock 2026-08-13 00:59:04 +03:00
58591d885a fix mpv service name 2026-08-13 00:59:04 +03:00
667579a984 fix(nix): fix nix config 2026-08-13 00:58:46 +03:00
25 changed files with 259 additions and 201 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,68 +0,0 @@
<h1 align="center">Kan`s dotfiles</h1>
<p align="center">
<a href="https://github.com/TheK4n">
<img src="https://img.shields.io/github/followers/TheK4n?label=Follow&style=social" alt="TheK4n">
</a>
<a href="https://github.com/TheK4n/dotfiles">
<img src="https://img.shields.io/github/stars/TheK4n/dotfiles?style=social" alt="project">
</a>
</p>
## Content
* [Project description](#chapter-0)
* [Installation](#chapter-1)
<a id="chapter-0"></a>
## Project description
Config files for:
* zsh
* alacritty
* tmux
* ssh
* git
* ranger
* sway
* vim
* nvim
### Prompt
<p align="center">
<img src=".assets/prompt.png" alt="Prompt">
</p>
You can add your files to the `~/.config/zsh/zshrc.d` directory for zsh so
that they automatically run in ascending order when you open a terminal.\
Example:\
`~/.config/zsh/zshrc.d/01_hello.sh`
```sh
echo "Hello $USER!"
```
<a id="chapter-1"></a>
## Installation
```sh
git clone https://github.com/TheK4n/dotfiles
cd dotfiles
./install zsh nvim ...
```
## Installation script
Per-user dotfiles "package" manager
### Features
1. Installing files from dotfiles/home/user to $HOME
2. Uninstalling installed files
3. Check installation integrity
4. Transaction based installation
5. Does not overwrite your configs
<h1 align="center"><a href="#top">▲</a></h1>

View File

@ -3,9 +3,9 @@
install_if_not_exists() {
local path="${HOME}/.config/zsh/plugins/${1}"
if [ ! -d "${path}" ]; then
/usr/bin/git clone "https://github.com/${1}" "${path}"
local dir="${HOME}/.local/share/zsh/plugins/${1}"
if [ ! -d "${dir}" ]; then
/usr/bin/env git clone "https://github.com/${1}" "${dir}"
fi
}

View File

@ -1,26 +1,8 @@
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git cvs svn

View File

@ -1,7 +1,7 @@
# vim: ft=zsh
_so() {
[ -r "${1}" ] && [ -f "${1}" ] && source "${1}"
[ -r "${1}" ] && [ -e "${1}" ] && source "${1}"
}
_sod() {
@ -18,6 +18,7 @@ _sod() {
}
_so "/etc/profile"
source "${ZDOTDIR}/options"
source "${ZDOTDIR}/completion"
source "${ZDOTDIR}/history"
@ -25,7 +26,6 @@ source "${ZDOTDIR}/prompt"
source "${ZDOTDIR}/other"
source "${ZDOTDIR}/aliases"
source "${ZDOTDIR}/functions"
_so "/etc/profile"
_so "${ZDOTDIR}/hosts/${HOST}"

86
flake.lock generated Normal file
View File

@ -0,0 +1,86 @@
{
"nodes": {
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1781152676,
"narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=",
"owner": "nix-community",
"repo": "disko",
"rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1786538400,
"narHash": "sha256-PH8B1YKxedcWKNw2xsk6cKPVk/rJoLgdlWd5d+Icies=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "e13ba5e5abbd9b912fa8c6979bd119e87ca7fdd9",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1786384358,
"narHash": "sha256-RzPPiWeUtuvymnpuEWsdtzli5w4kjZs49FqEs3/1u+I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2fcb964de67fcf60b43471c55d5d99e61a9ccb5a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1786430034,
"narHash": "sha256-Vux08kA5PICwS2sViCMfwVLAHNoH8TkKAeBo25LjpMI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "70cc4559b10a6062b05ff1af17e0add065ccaed9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable"
}
}
},
"root": "root",
"version": 7
}

View File

@ -9,15 +9,18 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-26.05";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, ... }@inputs:
outputs = { self, nixpkgs, home-manager, disko, ... }@inputs:
let
system = "x86_64-linux";
# Функция создания хоста
mkHost = { hostname, username, system ? "x86_64-linux", extraModules ? [ ] }:
nixpkgs.lib.nixosSystem {
inherit system;
@ -29,12 +32,15 @@
};
modules = [
# Системные модули
./hosts/default/configuration.nix
./hosts/${hostname}/configuration.nix
# Home Manager модуль
disko.nixosModules.disko
./hosts/${hostname}/disko.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
@ -42,7 +48,6 @@
users.${username} = import ./home/users/${username}.nix;
# Дополнительные аргументы для home-manager
extraSpecialArgs = {
inherit inputs;
hostname = hostname;
@ -54,12 +59,9 @@
in {
nixosConfigurations = {
desktop = mkHost {
hostname = "thek4n.ru";
thek4n = mkHost {
hostname = "thek4n";
username = "thek4n";
extraModules = [
./hosts/thek4n/hardware.nix
];
};
};

View File

@ -1,62 +1,44 @@
{ config, pkgs, inputs, ... }:
{
imports = [
inputs.home-manager.nixosModules.home-manager
];
home.homeDirectory = "/home/thek4n";
home.username = "thek4n";
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
home.stateVersion = "24.11";
users.thek4n = { pkgs, ... }: {
home.homeDirectory = "/home/thek4n";
home.username = "thek4n";
home.packages = with pkgs; [ ];
home.stateVersion = "24.11";
home.packages = with pkgs; [ ];
programs.git = {
enable = true;
userName = "thek4n";
userEmail = "thek4n@yandex.ru";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = false;
core.editor = "nvim";
};
};
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
};
programs.neovim = {
enable = true;
viAlias = true;
defaultEditor = true;
};
home.file = {
".config/sway".source = ../../configs/.config/sway;
".config/swaylock".source = ../../configs/.config/swaylock;
".config/waybar".source = ../../configs/.config/waybar;
".config/mako".source = ../../configs/.config/mako;
".config/kanshi".source = ../../configs/.config/kanshi;
".config/rofi".source = ../../configs/.config/rofi;
".config/yazi".source = ../../configs/.config/yazi;
".config/tmux".source = ../../configs/.config/tmux;
".config/alacritty".source = ../../configs/.config/alacritty;
".config/nvim".source = ../../configs/.config/nvim;
".config/zsh".source = ../../configs/.config/zsh;
".config/git".source = ../../configs/.config/git;
".zshenv".source = ../../configs/.zshenv;
".editorconfig".source = ../../configs/.editorconfig;
programs.git = {
enable = true;
settings = {
user.name = "thek4n";
user.email = "thek4n@yandex.ru";
init.defaultBranch = "main";
pull.rebase = false;
core.editor = "nvim";
};
};
};
};
programs.neovim = {
enable = true;
viAlias = true;
defaultEditor = true;
};
home.file = {
".config/sway".source = ../../configs/.config/sway;
".config/swaylock".source = ../../configs/.config/swaylock;
".config/waybar".source = ../../configs/.config/waybar;
".config/mako".source = ../../configs/.config/mako;
".config/kanshi".source = ../../configs/.config/kanshi;
".config/rofi".source = ../../configs/.config/rofi;
".config/yazi".source = ../../configs/.config/yazi;
".config/tmux".source = ../../configs/.config/tmux;
".config/alacritty".source = ../../configs/.config/alacritty;
".config/nvim".source = ../../configs/.config/nvim;
".config/zsh".source = ../../configs/.config/zsh;
".config/git".source = ../../configs/.config/git;
".zshenv".source = ../../configs/.zshenv;
".editorconfig".source = ../../configs/.editorconfig;
};
}

View File

@ -7,10 +7,8 @@
../../modules/services/ssh.nix
];
# Имя хоста
networking.hostName = hostname;
# Пользователь
users.users.${username} = {
isNormalUser = true;
description = username;
@ -26,9 +24,16 @@
man mpv noto-fonts p7zip poppler resvg ripgrep rofi slurp
socat sway swaybg swayidle swaylock tmux tree-sitter ueberzug
waybar wget wl-clipboard wlr-randr wtype yazi ydotool zoxide
docker httpie exa zsh
docker httpie home-manager
];
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestions.enable = true;
syntaxHighlighting.enable = true;
};
programs.firefox.enable = true;
services.greetd = {
@ -41,6 +46,8 @@
};
};
services.gpm.enable = true;
programs.sway = {
enable = true;
};
@ -62,8 +69,5 @@ bindsym $mod+Return exec $term
services.printing.enable = true;
services.rtkit.enable = true;
# Системное состояние
system.stateVersion = "26.05";
}

View File

@ -0,0 +1,11 @@
{ config, pkgs, inputs, lib, hostname, username, ... }:
{
imports = [
../../modules/user-services/mpv.nix
];
users.users.${username} = {
linger = true;
};
}

32
hosts/thek4n/disko.nix Normal file
View File

@ -0,0 +1,32 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
boot = {
size = "1G";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@ -1 +0,0 @@
todo:

View File

@ -1,6 +0,0 @@
#!/bin/sh
echo 'pacman -S man-pages man-db lesspipe'
echo 'echo "ParallelDownloads = 5\nVerbosePkgLists" >> /etc/pacman.conf'
echo 'sudo systemctl enable --now gpm'
echo 'sudo sysctl kernel.sysrq=1'

View File

@ -1,3 +0,0 @@
#!/bin/sh -eu
systemctl --user enable --now mpv

View File

@ -1,3 +0,0 @@
#!/bin/sh -eu
echo "sudo pacman -S mpv socat"

View File

@ -1,3 +0,0 @@
#!/bin/sh
echo "sudo pacman -S npm ctags fzf glow tree-sitter tree-sitter-cli; mkdir ~/.npm-global; npm config set prefix '~/.npm-global'"

View File

@ -1,4 +0,0 @@
#!/bin/sh
mkdir -p "${SANDBOX_PATH}/.config/ranger/plugins"
git clone https://github.com/alexanderjeurissen/ranger_devicons "${SANDBOX_PATH}/.config/ranger/plugins/ranger_devicons"

View File

@ -1,3 +0,0 @@
#!/bin/sh
echo "sudo pacman -S highlight ttf-joypixels noto-fonts-emoji ueberzug poppler"

View File

@ -1,3 +0,0 @@
#!/bin/sh
echo "pacman -S sway swaybg i3blocks waybar swaylock swayidle wl-clipboard ydotool grim slurp mako wlr-randr rofi jq brightnessctl kanshi wtype"

View File

@ -1,3 +0,0 @@
#!/bin/sh
echo 'pacman -S fd zoxide'

View File

@ -1,3 +0,0 @@
#!/bin/sh
echo 'sudo pacman -S yazi ffmpeg 7zip jq poppler fd ripgrep fzf zoxide resvg imagemagick'

View File

@ -1,14 +1,16 @@
{ config, pkgs, ... }:
{
# Загрузчик
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
# Ядро
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.kernel.sysctl = {
"kernel.sysrq" = 1;
};
}

View File

@ -10,8 +10,6 @@
PasswordAuthentication = false;
PermitRootLogin = "no";
Protocol = 2;
X11Forwarding = true;
LoginGraceTime = 30;

View File

@ -0,0 +1,61 @@
{ config, pkgs, inputs, lib, hostname, username, ... }:
let
mpv-service-script = pkgs.writeShellScriptBin "mpv-service" ''
#!/bin/sh -eu
SOCKET_PATH="/tmp/mpv-${username}.sock"
rm -f "''${SOCKET_PATH}"
cleanup() {
echo "Stopping MPV service..."
rm -f "''${SOCKET_PATH}"
pkill -P $$ mpv || true
}
trap cleanup EXIT TERM INT
exec ${pkgs.mpv}/bin/mpv \
--really-quiet \
--idle \
--no-video --force-window=no \
--input-ipc-server="''${SOCKET_PATH}" \
--demuxer-max-bytes=50MiB \
--demuxer-max-back-bytes=10MiB \
--audio-buffer=0.5
'';
in {
systemd.user.services.mpv = {
enable = true;
description = "MPV Audio Player Service with IPC";
documentation = [ "man:mpv(1)" ];
wantedBy = [ "default.target" ];
after = [ "sound.target" ];
wants = [ "sound.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${mpv-service-script}/bin/mpv-service";
Restart = "on-failure";
RestartSec = "5";
Environment = [
"DBUS_SESSION_BUS_ADDRESS=unix:path=%t/bus"
"XDG_RUNTIME_DIR=%t"
];
StandardOutput = "journal";
StandardError = "journal";
PrivateTmp = false;
ProtectSystem = "strict";
ProtectHome = "read-only";
NoNewPrivileges = true;
};
environment = {
MPV_SOCKET = "/tmp/mpv-${username}.sock";
};
};
}

View File

@ -1,2 +0,0 @@
#!/bin/sh -eu
exec docker run --rm -it --network none sandbox