diff --git a/install.conf.yaml b/install.conf.yaml index 0006fbf..99dec03 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -28,6 +28,7 @@ ~/.liquidprompt: bash/liquidprompt ~/.gitconfig: git/gitconfig ~/.profile.d/load: shell/load + ~/.profile.d/09-nixos-commited.sh: shell/nixos-commited.sh ~/.profile.d/10-vars.sh: shell/vars.sh ~/.profile.d/10-paths.sh: shell/paths.sh ~/.profile.d/10-gitrepo-commited.sh: shell/gitrepo-commited.sh diff --git a/shell/nixos-commited.sh b/shell/nixos-commited.sh new file mode 100755 index 0000000..bfdeda8 --- /dev/null +++ b/shell/nixos-commited.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +case "$-" in + *i*) + # This shell is interactive, if not ignore this part + # If printing this in non-interactive shells, it'll may prevent scp to work + if [ -d "/etc/nixos" ]; then + changes=`git -C /etc/nixos status --porcelain | wc -l` + + if [ $changes -gt 0 ]; then + echo -e '\e[01;31m' >&2 + echo -e '######################################' >&2 + echo -e '# NixOS-config-Repo is not commited! #' >&2 + echo -e '######################################' >&2 + echo -e '\e[0m' >&2 + fi + fi + ;; +esac