diff --git a/.assets/prompt.png b/.assets/prompt.png deleted file mode 100644 index 4f0f6c1..0000000 Binary files a/.assets/prompt.png and /dev/null differ diff --git a/README.md b/README.md deleted file mode 100644 index 20d3cbc..0000000 --- a/README.md +++ /dev/null @@ -1,68 +0,0 @@ -

Kan`s dotfiles

- -

- - TheK4n - - - project - -

- - -## Content - -* [Project description](#chapter-0) -* [Installation](#chapter-1) - - - -## Project description - -Config files for: -* zsh -* alacritty -* tmux -* ssh -* git -* ranger -* sway -* vim -* nvim - - -### Prompt -

- Prompt -

- -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!" -``` - - -## 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 - - -

▲

diff --git a/flake.nix b/flake.nix index aaec901..5e9625d 100644 --- a/flake.nix +++ b/flake.nix @@ -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 - ]; }; }; diff --git a/home/users/thek4n.nix b/home/users/thek4n.nix index 61de1b6..fe22353 100644 --- a/home/users/thek4n.nix +++ b/home/users/thek4n.nix @@ -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; + }; +} diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 05e4ea7..32d026b 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -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 ]; + 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"; } diff --git a/hosts/thek4n/configuration.nix b/hosts/thek4n/configuration.nix new file mode 100644 index 0000000..53ba264 --- /dev/null +++ b/hosts/thek4n/configuration.nix @@ -0,0 +1,11 @@ +{ config, pkgs, inputs, lib, hostname, username, ... }: + +{ + imports = [ + ../../modules/user-services/mpv.nix + ]; + + users.users.${username} = { + linger = true; + }; +} diff --git a/hosts/thek4n/disko.nix b/hosts/thek4n/disko.nix new file mode 100644 index 0000000..06036eb --- /dev/null +++ b/hosts/thek4n/disko.nix @@ -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 = "/"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/thek4n/hardware.nix b/hosts/thek4n/hardware.nix deleted file mode 100644 index 84fa199..0000000 --- a/hosts/thek4n/hardware.nix +++ /dev/null @@ -1 +0,0 @@ -todo: diff --git a/install-hooks/arch/pre-install b/install-hooks/arch/pre-install deleted file mode 100755 index d871be5..0000000 --- a/install-hooks/arch/pre-install +++ /dev/null @@ -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' \ No newline at end of file diff --git a/install-hooks/music/post-install b/install-hooks/music/post-install deleted file mode 100755 index 4df30b0..0000000 --- a/install-hooks/music/post-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -eu - -systemctl --user enable --now mpv diff --git a/install-hooks/music/pre-install b/install-hooks/music/pre-install deleted file mode 100755 index 3017ace..0000000 --- a/install-hooks/music/pre-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -eu - -echo "sudo pacman -S mpv socat" diff --git a/install-hooks/nvim/pre-install b/install-hooks/nvim/pre-install deleted file mode 100755 index 957b66e..0000000 --- a/install-hooks/nvim/pre-install +++ /dev/null @@ -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'" diff --git a/install-hooks/ranger/post-install b/install-hooks/ranger/post-install deleted file mode 100755 index 2fbdfab..0000000 --- a/install-hooks/ranger/post-install +++ /dev/null @@ -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" diff --git a/install-hooks/ranger/pre-install b/install-hooks/ranger/pre-install deleted file mode 100755 index ee22c97..0000000 --- a/install-hooks/ranger/pre-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "sudo pacman -S highlight ttf-joypixels noto-fonts-emoji ueberzug poppler" \ No newline at end of file diff --git a/install-hooks/sway/pre-install b/install-hooks/sway/pre-install deleted file mode 100755 index 206a942..0000000 --- a/install-hooks/sway/pre-install +++ /dev/null @@ -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" diff --git a/install-hooks/tmux/pre-install b/install-hooks/tmux/pre-install deleted file mode 100755 index bb08add..0000000 --- a/install-hooks/tmux/pre-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo 'pacman -S fd zoxide' diff --git a/install-hooks/yazi/pre-install b/install-hooks/yazi/pre-install deleted file mode 100755 index a724da6..0000000 --- a/install-hooks/yazi/pre-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo 'sudo pacman -S yazi ffmpeg 7zip jq poppler fd ripgrep fzf zoxide resvg imagemagick' diff --git a/modules/common/boot.nix b/modules/common/boot.nix index 622cddc..9a2eb19 100644 --- a/modules/common/boot.nix +++ b/modules/common/boot.nix @@ -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; + }; } diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix index ce45d48..bfe467b 100644 --- a/modules/services/ssh.nix +++ b/modules/services/ssh.nix @@ -10,8 +10,6 @@ PasswordAuthentication = false; PermitRootLogin = "no"; - Protocol = 2; - X11Forwarding = true; LoginGraceTime = 30; diff --git a/modules/user-services/mpv.nix b/modules/user-services/mpv.nix new file mode 100644 index 0000000..34a686e --- /dev/null +++ b/modules/user-services/mpv.nix @@ -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-service = { + 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"; + }; + }; +} diff --git a/opt/bin/sandbox b/opt/bin/sandbox deleted file mode 100755 index 9568dd7..0000000 --- a/opt/bin/sandbox +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -eu -exec docker run --rm -it --network none sandbox