fix(nix): fix nix config
This commit is contained in:
parent
6375b8e31f
commit
667579a984
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB |
68
README.md
68
README.md
@ -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>
|
|
||||||
24
flake.nix
24
flake.nix
@ -9,15 +9,18 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
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
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
# Функция создания хоста
|
|
||||||
mkHost = { hostname, username, system ? "x86_64-linux", extraModules ? [ ] }:
|
mkHost = { hostname, username, system ? "x86_64-linux", extraModules ? [ ] }:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
@ -29,12 +32,15 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
modules = [
|
modules = [
|
||||||
# Системные модули
|
|
||||||
./hosts/default/configuration.nix
|
./hosts/default/configuration.nix
|
||||||
./hosts/${hostname}/configuration.nix
|
./hosts/${hostname}/configuration.nix
|
||||||
|
|
||||||
# Home Manager модуль
|
disko.nixosModules.disko
|
||||||
|
|
||||||
|
./hosts/${hostname}/disko.nix
|
||||||
|
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
|
||||||
{
|
{
|
||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
@ -42,7 +48,6 @@
|
|||||||
|
|
||||||
users.${username} = import ./home/users/${username}.nix;
|
users.${username} = import ./home/users/${username}.nix;
|
||||||
|
|
||||||
# Дополнительные аргументы для home-manager
|
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
hostname = hostname;
|
hostname = hostname;
|
||||||
@ -54,12 +59,9 @@
|
|||||||
|
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
desktop = mkHost {
|
thek4n = mkHost {
|
||||||
hostname = "thek4n.ru";
|
hostname = "thek4n";
|
||||||
username = "thek4n";
|
username = "thek4n";
|
||||||
extraModules = [
|
|
||||||
./hosts/thek4n/hardware.nix
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,6 @@
|
|||||||
{ config, pkgs, inputs, ... }:
|
{ config, pkgs, inputs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
|
||||||
inputs.home-manager.nixosModules.home-manager
|
|
||||||
];
|
|
||||||
|
|
||||||
home-manager = {
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
|
|
||||||
users.thek4n = { pkgs, ... }: {
|
|
||||||
home.homeDirectory = "/home/thek4n";
|
home.homeDirectory = "/home/thek4n";
|
||||||
home.username = "thek4n";
|
home.username = "thek4n";
|
||||||
|
|
||||||
@ -19,22 +10,15 @@
|
|||||||
|
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
userName = "thek4n";
|
settings = {
|
||||||
userEmail = "thek4n@yandex.ru";
|
user.name = "thek4n";
|
||||||
extraConfig = {
|
user.email = "thek4n@yandex.ru";
|
||||||
init.defaultBranch = "main";
|
init.defaultBranch = "main";
|
||||||
pull.rebase = false;
|
pull.rebase = false;
|
||||||
core.editor = "nvim";
|
core.editor = "nvim";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.zsh = {
|
|
||||||
enable = true;
|
|
||||||
enableCompletion = true;
|
|
||||||
autosuggestion.enable = true;
|
|
||||||
syntaxHighlighting.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
viAlias = true;
|
viAlias = true;
|
||||||
@ -57,6 +41,4 @@
|
|||||||
".zshenv".source = ../../configs/.zshenv;
|
".zshenv".source = ../../configs/.zshenv;
|
||||||
".editorconfig".source = ../../configs/.editorconfig;
|
".editorconfig".source = ../../configs/.editorconfig;
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|||||||
@ -7,10 +7,8 @@
|
|||||||
../../modules/services/ssh.nix
|
../../modules/services/ssh.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Имя хоста
|
|
||||||
networking.hostName = hostname;
|
networking.hostName = hostname;
|
||||||
|
|
||||||
# Пользователь
|
|
||||||
users.users.${username} = {
|
users.users.${username} = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = username;
|
description = username;
|
||||||
@ -26,9 +24,16 @@
|
|||||||
man mpv noto-fonts p7zip poppler resvg ripgrep rofi slurp
|
man mpv noto-fonts p7zip poppler resvg ripgrep rofi slurp
|
||||||
socat sway swaybg swayidle swaylock tmux tree-sitter ueberzug
|
socat sway swaybg swayidle swaylock tmux tree-sitter ueberzug
|
||||||
waybar wget wl-clipboard wlr-randr wtype yazi ydotool zoxide
|
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;
|
programs.firefox.enable = true;
|
||||||
|
|
||||||
services.greetd = {
|
services.greetd = {
|
||||||
@ -41,6 +46,8 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.gpm.enable = true;
|
||||||
|
|
||||||
programs.sway = {
|
programs.sway = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
@ -62,8 +69,5 @@ bindsym $mod+Return exec $term
|
|||||||
|
|
||||||
services.printing.enable = true;
|
services.printing.enable = true;
|
||||||
|
|
||||||
services.rtkit.enable = true;
|
|
||||||
|
|
||||||
# Системное состояние
|
|
||||||
system.stateVersion = "26.05";
|
system.stateVersion = "26.05";
|
||||||
}
|
}
|
||||||
|
|||||||
11
hosts/thek4n/configuration.nix
Normal file
11
hosts/thek4n/configuration.nix
Normal 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
32
hosts/thek4n/disko.nix
Normal 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 = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1 +0,0 @@
|
|||||||
todo:
|
|
||||||
@ -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'
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh -eu
|
|
||||||
|
|
||||||
systemctl --user enable --now mpv
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh -eu
|
|
||||||
|
|
||||||
echo "sudo pacman -S mpv socat"
|
|
||||||
@ -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'"
|
|
||||||
@ -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"
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo "sudo pacman -S highlight ttf-joypixels noto-fonts-emoji ueberzug poppler"
|
|
||||||
@ -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"
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo 'pacman -S fd zoxide'
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo 'sudo pacman -S yazi ffmpeg 7zip jq poppler fd ripgrep fzf zoxide resvg imagemagick'
|
|
||||||
@ -1,14 +1,16 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
# Загрузчик
|
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
systemd-boot.enable = true;
|
systemd-boot.enable = true;
|
||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Ядро
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" ];
|
||||||
boot.kernelModules = [ ];
|
boot.kernelModules = [ ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
boot.kernel.sysctl = {
|
||||||
|
"kernel.sysrq" = 1;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,6 @@
|
|||||||
PasswordAuthentication = false;
|
PasswordAuthentication = false;
|
||||||
PermitRootLogin = "no";
|
PermitRootLogin = "no";
|
||||||
|
|
||||||
Protocol = 2;
|
|
||||||
|
|
||||||
X11Forwarding = true;
|
X11Forwarding = true;
|
||||||
|
|
||||||
LoginGraceTime = 30;
|
LoginGraceTime = 30;
|
||||||
|
|||||||
61
modules/user-services/mpv.nix
Normal file
61
modules/user-services/mpv.nix
Normal 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-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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,2 +0,0 @@
|
|||||||
#!/bin/sh -eu
|
|
||||||
exec docker run --rm -it --network none sandbox
|
|
||||||
Loading…
x
Reference in New Issue
Block a user