chezmoi: systemd

This commit is contained in:
js0ny 2025-09-27 14:40:01 +01:00
parent a891f968f8
commit b391e03c87
9 changed files with 40 additions and 57 deletions

View file

@ -29,4 +29,6 @@ dot_config/user-dirs.locale
# ArchLinux only # ArchLinux only
{{ if ne .chezmoi.osRelease.id "arch" -}} {{ if ne .chezmoi.osRelease.id "arch" -}}
chromium-flags.conf
electron-flags.conf
{{ end -}} {{ end -}}

View file

@ -0,0 +1,27 @@
# ~/.config/systemd/user/mihomo.service
[Unit]
Description=mihomo Service
# This ensures the service only starts after your network is online.
After=network-online.target
Wants=network-online.target
[Service]
# The main process to run.
# The WorkingDirectory is set to your user's home directory.
# This assumes your mihomo configuration is located at ~/.config/mihomo/
WorkingDirectory=%h/.config/mihomo
# It's common for user-level applications to be in a directory like ~/.local/bin
# or simply in your PATH.
ExecStart=mihomo
# This tells systemd to restart the service if it stops unexpectedly.
Restart=on-failure
# This sets the restart interval to 5 seconds.
RestartSec=5s
[Install]
# This unit should be active when the user's session is active,
# ensuring it starts when you log in.
WantedBy=default.target

View file

@ -1,4 +1,5 @@
# $DOTFILES/tools/zsh/common.zshrc # $DOTFILES/tools/zsh/common.zshrc
# vim:ft=zsh
# Date: 2024-11-30 # Date: 2024-11-30
# Author: js0ny # Author: js0ny
# This is the entry point for all zsh configuration files # This is the entry point for all zsh configuration files
@ -14,15 +15,22 @@ case "$(uname)" in
Linux) Linux)
if grep -q Microsoft /proc/version || [[ -n "$WSL_DISTRO_NAME" ]]; then if grep -q Microsoft /proc/version || [[ -n "$WSL_DISTRO_NAME" ]]; then
# WSL-specific configuration # WSL-specific configuration
source "$DOTFILES/platforms/wsl/zshrc" export IS_WSL=true
source $DOTFILES/platforms/wsl/winterop.zsh
else else
# Native Linux configuration # Native Linux configuration
source "$DOTFILES/platforms/linux/zshrc" if [ -n "$WAYLAND_DISPLAY" ]; then
alias clip="wl-copy"
alias paste="wl-paste"
elif [ -n "$DISPLAY" ]; then
alias clip="xclip"
fi
fi fi
;; ;;
Darwin) Darwin)
# macOS-specific configuration # macOS-specific configuration
source "$DOTFILES/platforms/mac/zshrc" alias clip="pbcopy"
alias paste="pbpaste"
;; ;;
# CYGWIN*|MINGW*|MSYS*) # CYGWIN*|MINGW*|MSYS*)
# source "$DOTFILES/platform/wsl.zsh" # source "$DOTFILES/platform/wsl.zsh"
@ -34,4 +42,3 @@ for file in $DOTFILES/tools/zsh/mod/*.zsh; do
done done
[ -f "/home/js0ny/.local/share/ghcup/env" ] && . "/home/js0ny/.local/share/ghcup/env" # ghcup-env [ -f "/home/js0ny/.local/share/ghcup/env" ] && . "/home/js0ny/.local/share/ghcup/env" # ghcup-env
. "/home/js0ny/.deno/env"

View file

@ -1,12 +0,0 @@
# $DOTFILES/platforms/linux/zshrc
# Date: 2024-12-22
# Author: js0ny
# Sourced by user's zshrc if is Linux 在用户的 zshrc 中被引用
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
if [ -n "$WAYLAND_DISPLAY" ]; then
alias clip="wl-copy"
alias paste="wl-paste"
elif [ -n "$DISPLAY" ]; then
alias clip="xclip"
fi

View file

@ -6,22 +6,3 @@
# macOS # # macOS #
alias clip="pbcopy"
alias paste="pbpaste"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
alias start-twm="source $DOTFILES/scripts/__twm_osx_start.zsh"

View file

@ -6,26 +6,4 @@
### Variables ### ### Variables ###
export IS_WSL=true export IS_WSL=true
export ARCHFLAGS="-arch x86_64"
source $DOTFILES/platforms/wsl/winterop.zsh source $DOTFILES/platforms/wsl/winterop.zsh
### Misc ###
export PATH=/opt/bin:$PATH
# Conda #
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('$HOME/miniconda3/bin/conda' 'shell.zsh' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then
. "$HOME/miniconda3/etc/profile.d/conda.sh"
else
export PATH="$HOME/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<