From 888a816c5fe12e89e6d3b035a82afcff6939f78b Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Mon, 1 Jul 2024 13:14:12 +0200 Subject: [PATCH] fix: do not hardcode user in the config files Signed-off-by: Matej Focko --- roles/user/git/templates/gitconfig | 4 ++-- roles/user/shell/zsh/tasks/oh-my-zsh.yml | 6 +++--- roles/user/shell/zsh/{files => templates}/zshrc | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename roles/user/shell/zsh/{files => templates}/zshrc (97%) diff --git a/roles/user/git/templates/gitconfig b/roles/user/git/templates/gitconfig index 29fa1cb..807b0e8 100644 --- a/roles/user/git/templates/gitconfig +++ b/roles/user/git/templates/gitconfig @@ -57,7 +57,7 @@ signingkey = {{ gpg_signingkey }} [includeIf "gitdir:~/git/github.com/packit/"] - path = /home/mfocko/git/github.com/packit/.gitconfig + path = /home/{{ target_user }}/git/github.com/packit/.gitconfig [includeIf "gitdir:~/git/gitlab.fi.muni.cz/"] - path = /home/mfocko/git/gitlab.fi.muni.cz/.gitconfig + path = /home/{{ target_user }}/git/gitlab.fi.muni.cz/.gitconfig diff --git a/roles/user/shell/zsh/tasks/oh-my-zsh.yml b/roles/user/shell/zsh/tasks/oh-my-zsh.yml index f62cec5..7bbe196 100644 --- a/roles/user/shell/zsh/tasks/oh-my-zsh.yml +++ b/roles/user/shell/zsh/tasks/oh-my-zsh.yml @@ -28,8 +28,8 @@ dest: ~/.oh-my-zsh/custom/plugins/zsh-aliases-exa update: no -- name: Install the config - ansible.builtin.copy: - src: files/zshrc +- name: Create the config + ansible.builtin.template: + src: templates/zshrc dest: ~/.zshrc mode: 0600 diff --git a/roles/user/shell/zsh/files/zshrc b/roles/user/shell/zsh/templates/zshrc similarity index 97% rename from roles/user/shell/zsh/files/zshrc rename to roles/user/shell/zsh/templates/zshrc index 872f563..8df1446 100644 --- a/roles/user/shell/zsh/files/zshrc +++ b/roles/user/shell/zsh/templates/zshrc @@ -1,4 +1,4 @@ -export ZSH="/home/mfocko/.oh-my-zsh" +export ZSH="/home/{{ target_user }}/.oh-my-zsh" ENABLE_CORRECTION=true plugins=(git common-aliases history systemd sudo zsh-autosuggestions zsh-syntax-highlighting eza fzf direnv taskwarrior zoxide) @@ -42,8 +42,8 @@ gpg_for_ssh if [[ $(command -v direnv 2> /dev/null) ]]; then eval "$(direnv hook zsh)"; fi -if [ -e /home/mfocko/.nix-profile/etc/profile.d/nix.sh ]; then - . /home/mfocko/.nix-profile/etc/profile.d/nix.sh; +if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then + . $HOME/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer ### Rust ###