From 4c4c80a704fb7cd1eb2a8a2b886c0419a0f461d6 Mon Sep 17 00:00:00 2001 From: thek4n Date: Thu, 13 Aug 2026 20:29:35 +0300 Subject: [PATCH] add tmux daemon --- etc/cron.hourly/99beep | 3 -- etc/skel/code/.gitkeep | 0 etc/skel/documents/.gitkeep | 0 etc/skel/downloads/.gitkeep | 0 etc/skel/playground/.gitkeep | 0 etc/skel/public/.permissions | 3 -- etc/sudoers | 5 ---- etc/sudoers.d/custompower | 1 - etc/sudoers.d/wireguard | 1 - etc/systemd/system/disable-caps.service | 10 ------- .../getty@tty1.service.d/autologin.conf | 4 --- .../getty@tty2.service.d/skip-username.conf | 3 -- etc/systemd/system/wol.service | 11 ------- etc/update-motd.d/10-figlet | 4 --- etc/update-motd.d/20-service-status.example | 10 ------- home/users/thek4n.nix | 12 ++++++++ install-hooks/sandbox/post-install | 28 ------------------ install-hooks/ssh/post-install | 3 -- install-hooks/starsector/post-install | 18 ------------ install-hooks/yazi/post-install | 3 -- modules/user-services/tmux.nix | 29 +++++++++++++++++++ 21 files changed, 41 insertions(+), 107 deletions(-) delete mode 100755 etc/cron.hourly/99beep delete mode 100644 etc/skel/code/.gitkeep delete mode 100644 etc/skel/documents/.gitkeep delete mode 100644 etc/skel/downloads/.gitkeep delete mode 100644 etc/skel/playground/.gitkeep delete mode 100644 etc/skel/public/.permissions delete mode 100644 etc/sudoers delete mode 100644 etc/sudoers.d/custompower delete mode 100644 etc/sudoers.d/wireguard delete mode 100644 etc/systemd/system/disable-caps.service delete mode 100644 etc/systemd/system/getty@tty1.service.d/autologin.conf delete mode 100644 etc/systemd/system/getty@tty2.service.d/skip-username.conf delete mode 100644 etc/systemd/system/wol.service delete mode 100755 etc/update-motd.d/10-figlet delete mode 100755 etc/update-motd.d/20-service-status.example delete mode 100755 install-hooks/sandbox/post-install delete mode 100755 install-hooks/ssh/post-install delete mode 100755 install-hooks/starsector/post-install delete mode 100755 install-hooks/yazi/post-install create mode 100644 modules/user-services/tmux.nix diff --git a/etc/cron.hourly/99beep b/etc/cron.hourly/99beep deleted file mode 100755 index 9fc8fc2..0000000 --- a/etc/cron.hourly/99beep +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -beep -f 4000 -l 150 -D 150 -n -f 4000 -l 150 diff --git a/etc/skel/code/.gitkeep b/etc/skel/code/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/etc/skel/documents/.gitkeep b/etc/skel/documents/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/etc/skel/downloads/.gitkeep b/etc/skel/downloads/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/etc/skel/playground/.gitkeep b/etc/skel/playground/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/etc/skel/public/.permissions b/etc/skel/public/.permissions deleted file mode 100644 index bb16bd8..0000000 --- a/etc/skel/public/.permissions +++ /dev/null @@ -1,3 +0,0 @@ -chmod 751 "${HOME}" -mkdir "${HOME}/public" -chmod 1777 "${HOME}/public" \ No newline at end of file diff --git a/etc/sudoers b/etc/sudoers deleted file mode 100644 index 04e3aa7..0000000 --- a/etc/sudoers +++ /dev/null @@ -1,5 +0,0 @@ -%wheel ALL=(ALL:ALL) NOPASSWD: ALL - -@includedir /etc/sudoers.d - -Defaults passwd_timeout=0 diff --git a/etc/sudoers.d/custompower b/etc/sudoers.d/custompower deleted file mode 100644 index eaea1b4..0000000 --- a/etc/sudoers.d/custompower +++ /dev/null @@ -1 +0,0 @@ -%custompower ALL= NOPASSWD: /sbin/reboot,/sbin/shutdown now,/sbin/systemctl suspend diff --git a/etc/sudoers.d/wireguard b/etc/sudoers.d/wireguard deleted file mode 100644 index e60db73..0000000 --- a/etc/sudoers.d/wireguard +++ /dev/null @@ -1 +0,0 @@ -%wireguard ALL= NOPASSWD: /sbin/systemctl start wg-quick@wg0.service,/sbin/systemctl stop wg-quick@wg0.service diff --git a/etc/systemd/system/disable-caps.service b/etc/systemd/system/disable-caps.service deleted file mode 100644 index dbca36f..0000000 --- a/etc/systemd/system/disable-caps.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Disable capslock - -[Service] -ExecStart=sh -c "dumpkeys | sed s/Caps_Lock/Control/ | loadkeys" -Type=oneshot - -[Install] -WantedBy=multi-user.target -After=multi-user.target diff --git a/etc/systemd/system/getty@tty1.service.d/autologin.conf b/etc/systemd/system/getty@tty1.service.d/autologin.conf deleted file mode 100644 index e71a50d..0000000 --- a/etc/systemd/system/getty@tty1.service.d/autologin.conf +++ /dev/null @@ -1,4 +0,0 @@ -[Service] -Type=simple -ExecStart= -ExecStart=-/sbin/agetty --noreset --noclear --autologin thek4n - ${TERM} diff --git a/etc/systemd/system/getty@tty2.service.d/skip-username.conf b/etc/systemd/system/getty@tty2.service.d/skip-username.conf deleted file mode 100644 index 00e011f..0000000 --- a/etc/systemd/system/getty@tty2.service.d/skip-username.conf +++ /dev/null @@ -1,3 +0,0 @@ -[Service] -ExecStart= -ExecStart=-/sbin/agetty -o '-p -- %%USER%%' --noclear --skip-login - $TERM diff --git a/etc/systemd/system/wol.service b/etc/systemd/system/wol.service deleted file mode 100644 index 4d24e1d..0000000 --- a/etc/systemd/system/wol.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Wake-on-LAN for enp3s0 -Requires=network.target -After=network.target - -[Service] -ExecStart=/usr/bin/ethtool -s enp3s0 wol g -Type=oneshot - -[Install] -WantedBy=multi-user.target diff --git a/etc/update-motd.d/10-figlet b/etc/update-motd.d/10-figlet deleted file mode 100755 index a3cbfbc..0000000 --- a/etc/update-motd.d/10-figlet +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -echo -figlet -ct -f banner "welcome mr.kan" -echo \ No newline at end of file diff --git a/etc/update-motd.d/20-service-status.example b/etc/update-motd.d/20-service-status.example deleted file mode 100755 index a52c1a2..0000000 --- a/etc/update-motd.d/20-service-status.example +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -echo "wg0 status: $(systemctl is-active wg-quick@wg0.service)" - -if ! systemctl is-active wg-quick@wg0.service 1>/dev/null; then - #shellcheck disable=SC2016 - echo 'Executing this command may fix wireguard: "sudo apt update && sudo apt install linux-headers-$(uname -r) && sudo reboot"' -fi - -echo diff --git a/home/users/thek4n.nix b/home/users/thek4n.nix index c6d6675..2e3d9f9 100644 --- a/home/users/thek4n.nix +++ b/home/users/thek4n.nix @@ -37,8 +37,20 @@ ".config/nvim".source = ../../configs/.config/nvim; ".config/zsh".source = ../../configs/.config/zsh; ".config/git".source = ../../configs/.config/git; + ".config/mimeapps.list".source = ../../configs/.config/mimeapps.list; + ".config/terminal-colors.d".source = ../../configs/.config/terminal-colors.d; ".zshenv".source = ../../configs/.zshenv; ".editorconfig".source = ../../configs/.editorconfig; + ".editrc".source = ../../configs/.editrc; + ".gnupg".source = ../../configs/.gnupg; + ".infokey".source = ../../configs/.infokey; + ".inputrc".source = ../../configs/.inputrc; + ".lesskey".source = ../../configs/.lesskey; + ".local/bin".source = ../../configs/.local/bin; + ".docker".source = ../../configs/.docker; + ".mozilla".source = ../../configs/.mozilla; + ".tmux/landing".source = ../../configs/.tmux/landing; + ".tmux/ssh".source = ../../configs/.tmux/ssh; }; imports = [ diff --git a/install-hooks/sandbox/post-install b/install-hooks/sandbox/post-install deleted file mode 100755 index 5c7d101..0000000 --- a/install-hooks/sandbox/post-install +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - - -sudo useradd -M -s /opt/bin/sandbox sandbox -sudo usermod -aG docker sandbox -echo "/opt/bin/sandbox" | sudo tee -a /etc/shells # for pam - - -set -eu - - -cd "$(mktemp -d)" -cat > Dockerfile << EOF -FROM debian:bookworm-slim - - -RUN apt update -y && apt upgrade -y && apt install -y neovim zsh git wget && \ - useradd -Um -s /bin/zsh sandbox - -WORKDIR /home/sandbox -USER sandbox - -RUN git clone https://github.com/thek4n/dotfiles && cd dotfiles && ./install zsh && zsh -i - -ENTRYPOINT ["zsh"] -EOF - -docker build -t sandbox . \ No newline at end of file diff --git a/install-hooks/ssh/post-install b/install-hooks/ssh/post-install deleted file mode 100755 index c9a808a..0000000 --- a/install-hooks/ssh/post-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -cat "${SUB}/.ssh/config" >> "${HOME}/.ssh/config" diff --git a/install-hooks/starsector/post-install b/install-hooks/starsector/post-install deleted file mode 100755 index 2083f08..0000000 --- a/install-hooks/starsector/post-install +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -set -eu - -prefix="${HOME}/Games" -mkdir "${prefix}" || true - -cd "${prefix}" -wget -c -O "${prefix}/starsector.zip" "https://f005.backblazeb2.com/file/fractalsoftworks/release/starsector_linux-0.98a-RC8.zip" -unzip "${prefix}/starsector.zip" - - -wget -c -O "${prefix}/starsector-rusificator.zip" "https://paste.thek4n.ru/lvsaHLOAmFfqnv/" -unzip -o "${prefix}/starsector-rusificator.zip" - - -cd "${prefix}/starsector/mods/" -wget -c -O "${prefix}/starsector/mods/Unthemed Weapons Collection.zip" "https://paste.thek4n.ru/pGbkhFFgGcSysm/" -unzip "${prefix}/starsector/mods/Unthemed Weapons Collection.zip" diff --git a/install-hooks/yazi/post-install b/install-hooks/yazi/post-install deleted file mode 100755 index 32c363a..0000000 --- a/install-hooks/yazi/post-install +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -ya pkg install diff --git a/modules/user-services/tmux.nix b/modules/user-services/tmux.nix new file mode 100644 index 0000000..7e1a497 --- /dev/null +++ b/modules/user-services/tmux.nix @@ -0,0 +1,29 @@ +{ config, pkgs, inputs, lib, hostname, username, ... }: + +{ + systemd.user.services.tmux = { + enable = true; + description = "User tmux daemon;"; + + wantedBy = [ "default.target" ]; + after = [ "default.target" ]; + + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.tmux}/bin/tmux -D -L %u"; + ExecStop = "${pkgs.tmux}/bin/tmux -L %u kill-server"; + ExecReload = "${pkgs.tmux}/bin/tmux -L %u source-file %h/.config/tmux/tmux.conf"; + ExecStartPost = "${pkgs.tmux}/bin/tmux -L %u new-session -d -s landing 'sh -c \"${pkgs.tmux}/bin/tmux rename-window -t 1 landing; ${pkgs.tmux}/bin/tmux set-option remain-on-exit on; ${pkgs.figlet}/bin/figlet -w 200 -c -f big Landing; ${pkgs.coreutils}/bin/trap : INT; while true; do ${pkgs.coreutils}/bin/sleep 3600; done\"'"; + Restart = "on-failure"; + RestartSec = "5"; + + StandardOutput = "journal"; + StandardError = "journal"; + + PrivateTmp = false; + ProtectSystem = "strict"; + ProtectHome = "read-only"; + NoNewPrivileges = true; + }; + }; +}