ensure nix profile directory exists and remove initial shellcheck/shfmt for initial run compatibility

main
Andrew Coleman 2024-02-05 12:37:22 -05:00
parent b20d00bcf2
commit f0b85cc96c
1 changed files with 5 additions and 8 deletions

View File

@ -4,9 +4,6 @@
cd "$(dirname "$0")" || exit 1 cd "$(dirname "$0")" || exit 1
shellcheck "$0" || exit 1
shfmt -i 2 -d -s "$0"
has_bin() { has_bin() {
[ -e "$HOME/.nix-profile/bin/$1" ] [ -e "$HOME/.nix-profile/bin/$1" ]
} }
@ -17,13 +14,15 @@ if ! pgrep nix-daemon >/dev/null 2>&1; then
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
# shellcheck disable=SC1091 # shellcheck disable=SC1091
. /nix/var/nix/profiles/default/etc/profile.d/nix.sh . /nix/var/nix/profiles/default/etc/profile.d/nix.sh
else
echo "Attempting nix upgrade... may prompt for sudo password"
sudo nix upgrade-nix
fi fi
PATH="$PATH:$HOME/.nix-profile/bin" PATH="$PATH:$HOME/.nix-profile/bin"
if [ ! -d "/nix/var/nix/profiles/per-user/$(whoami)" ]; then
sudo mkdir "/nix/var/nix/profiles/per-user/$(whoami)"
sudo chown -R "$(whoami)" "/nix/var/nix/profiles/per-user/$(whoami)"
fi
has_bin "cachix" || nix profile install nixpkgs#cachix has_bin "cachix" || nix profile install nixpkgs#cachix
if ! has_bin "devenv"; then if ! has_bin "devenv"; then
cachix use devenv cachix use devenv
@ -95,7 +94,6 @@ has_bin "nurl" || nix profile install nixpkgs#nurl
has_bin "nvim" || nix profile install nixpkgs#neovim has_bin "nvim" || nix profile install nixpkgs#neovim
has_bin "ouch" || nix profile install nixpkgs#ouch has_bin "ouch" || nix profile install nixpkgs#ouch
has_bin "pstree" || nix profile install nixpkgs#pstree has_bin "pstree" || nix profile install nixpkgs#pstree
#nix profile install nixpkgs#prettylist
has_bin "q" || nix profile install nixpkgs#q has_bin "q" || nix profile install nixpkgs#q
has_bin "rg" || nix profile install nixpkgs#ripgrep has_bin "rg" || nix profile install nixpkgs#ripgrep
has_bin "rq" || nix profile install nixpkgs#rq has_bin "rq" || nix profile install nixpkgs#rq
@ -105,7 +103,6 @@ has_bin "shellcheck" || nix profile install nixpkgs#shellcheck
has_bin "shfmt" || nix profile install nixpkgs#shfmt has_bin "shfmt" || nix profile install nixpkgs#shfmt
has_bin "spacer" || nix profile install nixpkgs#spacer has_bin "spacer" || nix profile install nixpkgs#spacer
has_bin "starship" || nix profile install nixpkgs#starship has_bin "starship" || nix profile install nixpkgs#starship
has_bin "terminal-notifier" || nix profile install nixpkgs#terminal-notifier
has_bin "tig" || nix profile install nixpkgs#tig has_bin "tig" || nix profile install nixpkgs#tig
has_bin "tldr" || nix profile install nixpkgs#tealdeer has_bin "tldr" || nix profile install nixpkgs#tealdeer
has_bin "tokei" || nix profile install nixpkgs#tokei has_bin "tokei" || nix profile install nixpkgs#tokei