From e1976612f0054a8143f37e7ef25c4ef4b88b44bd Mon Sep 17 00:00:00 2001 From: Emily Date: Wed, 15 Jan 2025 18:41:10 +0000 Subject: [PATCH] system: tweak ShellCheck settings --- modules/networking/default.nix | 1 - modules/nix/default.nix | 2 -- modules/system/checks.nix | 4 ---- modules/system/default.nix | 5 ++++- modules/users/default.nix | 5 ----- 5 files changed, 4 insertions(+), 13 deletions(-) diff --git a/modules/networking/default.nix b/modules/networking/default.nix index 7a81ca1c..b53a9e4a 100644 --- a/modules/networking/default.nix +++ b/modules/networking/default.nix @@ -118,7 +118,6 @@ in echo "configuring networking..." >&2 ${optionalString (cfg.computerName != null) '' - # shellcheck disable=SC1112 scutil --set ComputerName ${escapeShellArg cfg.computerName} ''} ${optionalString (cfg.hostName != null) '' diff --git a/modules/nix/default.nix b/modules/nix/default.nix index 8d8ffc8d..857c4be8 100644 --- a/modules/nix/default.nix +++ b/modules/nix/default.nix @@ -853,9 +853,7 @@ in fi done if [[ ! $nixCustomConfIsKnown ]]; then - # shellcheck disable=SC2016 printf >&2 '\e[1;31merror: custom settings in `/etc/nix/nix.custom.conf`, aborting activation\e[0m\n' - # shellcheck disable=SC2016 printf >&2 'You will need to migrate these to nix-darwin `nix.*` settings if you\n' printf >&2 'wish to keep them. Check the manual for the appropriate settings and\n' printf >&2 'add them to your system configuration, then run:\n' diff --git a/modules/system/checks.nix b/modules/system/checks.nix index c1ab4095..fade846d 100644 --- a/modules/system/checks.nix +++ b/modules/system/checks.nix @@ -141,7 +141,6 @@ let printf >&2 'Possible causes include setting up a new Nix installation with an\n' printf >&2 'existing nix-darwin configuration, setting up a new nix-darwin\n' printf >&2 'installation with an existing Nix installation, or manually increasing\n' - # shellcheck disable=SC2016 printf >&2 'your `system.stateVersion` setting.\n' printf >&2 '\n' printf >&2 'You can set the configured group ID to match the actual value:\n' @@ -162,7 +161,6 @@ let printf >&2 '\n' printf >&2 ' services.nix-daemon.enable = false;\n' printf >&2 '\n' - # shellcheck disable=SC2016 printf >&2 'and remove `nix.useDaemon` from your configuration if it is present.\n' printf >&2 '\n' exit 2 @@ -302,7 +300,6 @@ let if [[ -d /etc/ssh/authorized_keys.d ]]; then printf >&2 '\e[1;31merror: /etc/ssh/authorized_keys.d exists, aborting activation\e[0m\n' printf >&2 'SECURITY NOTICE: The previous implementation of the\n' - # shellcheck disable=SC2016 printf >&2 '`users.users..openssh.authorizedKeys.*` options would not delete\n' printf >&2 'authorized keys files when the setting for a given user was removed.\n' printf >&2 '\n' @@ -325,7 +322,6 @@ let echo "Homebrew doesn't seem to be installed. Please install homebrew separately." >&2 echo "You can install homebrew using the following command:" >&2 echo >&2 - # shellcheck disable=SC2016 echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' >&2 echo >&2 exit 2 diff --git a/modules/system/default.nix b/modules/system/default.nix index a1862fae..8351dcc6 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -135,7 +135,10 @@ in chmod u+x $out/activate-user unset activationUserScript - shellcheck $out/activate $out/activate-user + # We exclude the warnings for `…` in single‐quote strings and + # non‐ASCII quotation marks as they are noisy and lead to a lot + # of false positives in our user‐facing output: + shellcheck --exclude=SC2016,SC1112 $out/activate $out/activate-user echo -n "$systemConfig" > $out/systemConfig diff --git a/modules/users/default.nix b/modules/users/default.nix index 574f5a4e..ecce2af3 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -149,7 +149,6 @@ in if ! sudo dscl . -change /Users/nobody NFSHomeDirectory "$homeDirectory" "$homeDirectory" &> /dev/null; then if [[ -n "$SSH_CONNECTION" ]]; then printf >&2 '\e[1;31merror: users cannot be %s over SSH without Full Disk Access, aborting activation\e[0m\n' "$2" - # shellcheck disable=SC2016 printf >&2 'The user %s could not be %s as `darwin-rebuild` was not executed with Full Disk Access over SSH.\n' "$1" "$2" printf >&2 'You can either:\n' printf >&2 '\n' @@ -157,7 +156,6 @@ in printf >&2 '\n' printf >&2 'or\n' printf >&2 '\n' - # shellcheck disable=SC2016 printf >&2 ' run `darwin-rebuild` in a graphical session.\n' printf >&2 '\n' printf >&2 'The option "Allow full disk access for remote users" can be found by\n' @@ -171,11 +169,9 @@ in if ! sudo dscl . -change /Users/nobody NFSHomeDirectory "$homeDirectory" "$homeDirectory" &> /dev/null; then printf >&2 '\e[1;31merror: permission denied when trying to %s user %s, aborting activation\e[0m\n' "$2" "$1" - # shellcheck disable=SC2016 printf >&2 '`darwin-rebuild` requires permissions to administrate your computer,\n' printf >&2 'please accept the dialog that pops up.\n' printf >&2 '\n' - # shellcheck disable=SC2016 printf >&2 'If you do not wish to be prompted every time `darwin-rebuild updates your users,\n' printf >&2 'you can grant Full Disk Access to your terminal emulator in System Settings.\n' printf >&2 '\n' @@ -224,7 +220,6 @@ in if [ "$u" -gt 501 ]; then # TODO: add `darwin.primaryUser` as well if [[ ${name} == "$USER" ]]; then - # shellcheck disable=SC2016 printf >&2 '\e[1;31merror: refusing to delete the user calling `darwin-rebuild` (%s), aborting activation\e[0m\n', ${name} exit 1 fi