From 861136c47596a0cf6de8ff5bb91fefd29d69642e Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 31 Aug 2023 10:41:17 +0000 Subject: [PATCH 1/2] treewide: add 'shellcheck shell' directives I used 'bash' for zsh files, since that's the closest and `shell=zsh` is not supported [1]. [1]: https://github.com/koalaman/shellcheck/issues/809 --- bootstrap.sh | 1 + home/zsh/completion-styles.zsh | 2 ++ home/zsh/extra-mappings.zsh | 1 + home/zsh/options.zsh | 2 ++ 4 files changed, 6 insertions(+) diff --git a/bootstrap.sh b/bootstrap.sh index b1c418e..955617d 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,5 +1,6 @@ #!/usr/bin/env nix-shell #! nix-shell -i bash -p bitwarden-cli git gnupg jq nix +# shellcheck shell=bash # Command failure is script failure set -e diff --git a/home/zsh/completion-styles.zsh b/home/zsh/completion-styles.zsh index 156bc2c..87bb014 100644 --- a/home/zsh/completion-styles.zsh +++ b/home/zsh/completion-styles.zsh @@ -1,3 +1,5 @@ +# shellcheck shell=bash + # Style the completion a bit zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # Show a prompt on selection diff --git a/home/zsh/extra-mappings.zsh b/home/zsh/extra-mappings.zsh index 3456e13..fea2f96 100644 --- a/home/zsh/extra-mappings.zsh +++ b/home/zsh/extra-mappings.zsh @@ -1,3 +1,4 @@ +# shellcheck shell=bash # shellcheck disable=2154 # Fix Ctrl+u killing from the cursor instead of the whole line diff --git a/home/zsh/options.zsh b/home/zsh/options.zsh index 82047ff..32da8d8 100644 --- a/home/zsh/options.zsh +++ b/home/zsh/options.zsh @@ -1,3 +1,5 @@ +# shellcheck shell=bash + # Show an error when a globbing expansion doesn't find any match setopt nomatch # List on ambiguous completion and Insert first match immediately From 8bcf56fdec63be3ed9a3d6c8fd36ffdfc456f247 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 31 Aug 2023 10:42:45 +0000 Subject: [PATCH 2/2] treewide: fix `shellcheck` issues --- bootstrap.sh | 1 - home/zsh/completion-styles.zsh | 2 ++ home/zsh/extra-mappings.zsh | 1 - hosts/nixos/porthos/install.sh | 3 ++- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 955617d..db1662e 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -11,7 +11,6 @@ BOLD_GREEN="\e[0;1;32m" RESET="\e[0m" -DEST="$HOME/.config/nixpkgs" BW_SESSION="" warn() { diff --git a/home/zsh/completion-styles.zsh b/home/zsh/completion-styles.zsh index 87bb014..c3d664d 100644 --- a/home/zsh/completion-styles.zsh +++ b/home/zsh/completion-styles.zsh @@ -1,6 +1,7 @@ # shellcheck shell=bash # Style the completion a bit +# shellcheck disable=2086,2296 zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # Show a prompt on selection zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' @@ -23,6 +24,7 @@ zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' '*?.old' # command for process lists, the local web server details and host completion # on processes completion complete all user processes +# shellcheck disable=2016 zstyle ':completion:*:processes' command 'ps -au$USER' # Completion formatting and messages diff --git a/home/zsh/extra-mappings.zsh b/home/zsh/extra-mappings.zsh index fea2f96..25c230d 100644 --- a/home/zsh/extra-mappings.zsh +++ b/home/zsh/extra-mappings.zsh @@ -1,5 +1,4 @@ # shellcheck shell=bash -# shellcheck disable=2154 # Fix Ctrl+u killing from the cursor instead of the whole line bindkey '^u' backward-kill-line diff --git a/hosts/nixos/porthos/install.sh b/hosts/nixos/porthos/install.sh index de87aa7..8edc175 100644 --- a/hosts/nixos/porthos/install.sh +++ b/hosts/nixos/porthos/install.sh @@ -30,6 +30,7 @@ swapon /dev/sda2 apt install sudo useradd -m -G sudo setupuser +# shellcheck disable=2117 su setupuser cat << EOF @@ -37,7 +38,7 @@ cat << EOF curl -L https://nixos.org/nix/install | sh . $HOME/.nix-profile/etc/profile.d/nix.sh nix-channel --add https://nixos.org/channels/nixos-20.09 nixpkgs -sudo `which nixos-generate-config` --root /mnt +sudo "$(which nixos-generate-config)" --root /mnt # Change uuids to labels vim /mnt/etc/nixos/hardware-configuration.nix