From c34911ba26398dbf699eebd782ab1c2b4f671bde Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Mon, 24 Jul 2023 22:37:07 +0800 Subject: [PATCH] fix: skip load alias_for_work if it does not exist --- home/base/desktop/shell.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/home/base/desktop/shell.nix b/home/base/desktop/shell.nix index e2b35f20..5778268d 100644 --- a/home/base/desktop/shell.nix +++ b/home/base/desktop/shell.nix @@ -3,12 +3,21 @@ programs.bash = { # load the alias file for work bashrcExtra = '' - source /etc/agenix/alias-for-work.bash + alias_for_work=/etc/agenix/alias-for-work.bash + if [ -f $alias_for_work ]; then + . $alias_for_work + else + echo "No alias file found for work" + fi ''; }; programs.nushell = { # load the alias file for work + # the file must exist, otherwise nushell will complain about it! + # + # currently, nushell does not support conditional sourcing of files + # https://github.com/nushell/nushell/issues/8214 extraConfig = '' source /etc/agenix/alias-for-work.nushell '';