From 303a8143a43579d12b4996ad3ab0e8380ae8c8b5 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 12 Jan 2025 00:39:05 +0000 Subject: [PATCH 1/7] =?UTF-8?q?checks:=20check=20for=20macOS=20=E2=89=A5?= =?UTF-8?q?=2011.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/system/checks.nix | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/modules/system/checks.nix b/modules/system/checks.nix index 57ddfd277..26d6d9db6 100644 --- a/modules/system/checks.nix +++ b/modules/system/checks.nix @@ -24,6 +24,29 @@ let fi ''; + macOSVersion = '' + IFS=. read -ra osVersion <<<"$(sw_vers --productVersion)" + if (( osVersion[0] < 11 || (osVersion[0] == 11 && osVersion[1] < 3) )); then + printf >&2 '\e[1;31merror: macOS version is less than 11.3, aborting activation\e[0m\n' + printf >&2 'Nixpkgs 25.05 requires macOS Big Sur 11.3 or newer, and 25.11 will\n' + printf >&2 'require macOS Sonoma 14.\n' + printf >&2 '\n' + printf >&2 'For more information on your options going forward, see the 25.05\n' + printf >&2 'release notes:\n' + printf >&2 '\n' + printf >&2 '\n' + printf >&2 'Nixpkgs 24.11 and nix-darwin 24.11 continue to support down to macOS\n' + printf >&2 'Sierra 10.12, and will be supported through June 2025.\n' + printf >&2 '\n' + printf >&2 'You can override this check by setting:\n' + printf >&2 '\n' + printf >&2 ' system.checks.verifyMacOSVersion = false;\n' + printf >&2 '\n' + printf >&2 'However, we are unable to provide support if you do so.\n' + exit 1 + fi + ''; + runLink = '' if [[ ! -e /run ]]; then printf >&2 'error: directory /run does not exist, aborting activation\n' @@ -341,6 +364,12 @@ in description = "Whether to run the Nix build users validation checks."; }; + system.checks.verifyMacOSVersion = mkOption { + type = types.bool; + default = true; + description = "Whether to run the macOS version check."; + }; + system.checks.text = mkOption { internal = true; type = types.lines; @@ -352,6 +381,7 @@ in system.checks.text = mkMerge [ darwinChanges + (mkIf cfg.verifyMacOSVersion macOSVersion) runLink (mkIf (cfg.verifyBuildUsers && !config.nix.configureBuildUsers) oldBuildUsers) (mkIf cfg.verifyBuildUsers buildUsers) From ed6c4aabeae2ae8869a647eee04a45372a74ab56 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 12 Jan 2025 16:49:02 +0000 Subject: [PATCH 2/7] system: remove code for macOS < 11 --- modules/system/base.nix | 77 ++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/modules/system/base.nix b/modules/system/base.nix index 2374855a4..fb27c545d 100644 --- a/modules/system/base.nix +++ b/modules/system/base.nix @@ -2,60 +2,35 @@ { system.activationScripts.createRun.text = '' - IFS="." read -r -a macOSVersion <<< "$(sw_vers -productVersion)" - - if [[ ''${macOSVersion[0]} -gt 10 || ( ''${macOSVersion[0]} -eq 10 && ''${macOSVersion[1]} -ge 15 ) ]]; then - if [[ $(stat -c '%a' /etc/synthetic.conf) != "644" ]]; then - echo "fixing permissions on /etc/synthetic.conf..." - sudo chmod 644 /etc/synthetic.conf - fi - - if [[ $(grep -c '^run\b' /etc/synthetic.conf) -gt 1 ]]; then - echo "found duplicate run entries in /etc/synthetic.conf, removing..." - sudo sed -i "" -e '/^run\tprivate\/var\/run$/d' /etc/synthetic.conf - fi - - if ! grep -q '^run\b' /etc/synthetic.conf 2>/dev/null; then - echo "setting up /run via /etc/synthetic.conf..." - printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf >/dev/null - fi - - if [[ ''${macOSVersion[0]} -gt 10 ]]; then - sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true - else - sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B || true - fi - - if [[ ! -L /run ]]; then - printf >&2 'error: apfs.util failed to symlink /run, aborting activation\n' - printf >&2 'To create a symlink from /run to /var/run, please run:\n' - printf >&2 '\n' - printf >&2 "$ printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf" + if [[ $(stat -c '%a' /etc/synthetic.conf) != "644" ]]; then + echo "fixing permissions on /etc/synthetic.conf..." + sudo chmod 644 /etc/synthetic.conf + fi - if [[ ''${macOSVersion[0]} -gt 10 ]]; then - printf >&2 '$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t\n' - else - printf >&2 '$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B\n' - fi + if [[ $(grep -c '^run\b' /etc/synthetic.conf) -gt 1 ]]; then + echo "found duplicate run entries in /etc/synthetic.conf, removing..." + sudo sed -i "" -e '/^run\tprivate\/var\/run$/d' /etc/synthetic.conf + fi - printf >&2 '\n' - printf >&2 'The current contents of /etc/synthetic.conf is:\n' - printf >&2 '\n' - sudo sed 's/^/ /' /etc/synthetic.conf >&2 - printf >&2 '\n' - exit 1 - fi - else - echo "setting up /run..." - sudo ln -sfn private/var/run /run + if ! grep -q '^run\b' /etc/synthetic.conf 2>/dev/null; then + echo "setting up /run via /etc/synthetic.conf..." + printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf >/dev/null + fi - if [[ ! -L /run ]]; then - printf >&2 'error: failed to symlink /run, aborting activation\n' - printf >&2 'To create a symlink from /run to /var/run, please run:\n' - printf >&2 '\n' - printf >&2 '$ sudo ln -sfn private/var/link /run\n' - exit 1 - fi + sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t || true + + if [[ ! -L /run ]]; then + printf >&2 'error: apfs.util failed to symlink /run, aborting activation\n' + printf >&2 'To create a symlink from /run to /var/run, please run:\n' + printf >&2 '\n' + printf >&2 "$ printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf" + printf >&2 '$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t\n' + printf >&2 '\n' + printf >&2 'The current contents of /etc/synthetic.conf is:\n' + printf >&2 '\n' + sudo sed 's/^/ /' /etc/synthetic.conf >&2 + printf >&2 '\n' + exit 1 fi ''; } From b721000dc6990f3a9ac8e5f8c9fcd7431c4396af Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 12 Jan 2025 16:49:25 +0000 Subject: [PATCH 3/7] system: add missing newline --- modules/system/base.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/base.nix b/modules/system/base.nix index fb27c545d..6d5e2a96f 100644 --- a/modules/system/base.nix +++ b/modules/system/base.nix @@ -23,7 +23,7 @@ printf >&2 'error: apfs.util failed to symlink /run, aborting activation\n' printf >&2 'To create a symlink from /run to /var/run, please run:\n' printf >&2 '\n' - printf >&2 "$ printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf" + printf >&2 "$ printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf\n" printf >&2 '$ sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t\n' printf >&2 '\n' printf >&2 'The current contents of /etc/synthetic.conf is:\n' From 1c21c9410eefec51cb7613d38250e49322eb0ab5 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 14 Jan 2025 02:19:01 +0000 Subject: [PATCH 4/7] system: remove unnecessary `sudo` --- modules/system/base.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/base.nix b/modules/system/base.nix index 6d5e2a96f..40c3699b2 100644 --- a/modules/system/base.nix +++ b/modules/system/base.nix @@ -28,7 +28,7 @@ printf >&2 '\n' printf >&2 'The current contents of /etc/synthetic.conf is:\n' printf >&2 '\n' - sudo sed 's/^/ /' /etc/synthetic.conf >&2 + sed 's/^/ /' /etc/synthetic.conf >&2 printf >&2 '\n' exit 1 fi From 8f4f3d8d2d333248f5edf8bb9ef7c7d3274bf06f Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 14 Jan 2025 15:55:50 +0000 Subject: [PATCH 5/7] darwin-uninstaller: remove code for macOS < 11 --- pkgs/darwin-uninstaller/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/darwin-uninstaller/default.nix b/pkgs/darwin-uninstaller/default.nix index da58682e3..93092a8fb 100644 --- a/pkgs/darwin-uninstaller/default.nix +++ b/pkgs/darwin-uninstaller/default.nix @@ -56,7 +56,6 @@ in writeShellApplication { if [[ -L /run ]]; then if [[ -e /etc/synthetic.conf ]]; then sudo sed -i -E '/^run[[:space:]]/d' /etc/synthetic.conf - sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -B &>/dev/null || true sudo /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t &>/dev/null || true echo >&2 "NOTE: the /run symlink will be removed on reboot" else From c5b7b604caad7924924f762b603a978c33091552 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 12 Jan 2025 17:26:47 +0000 Subject: [PATCH 6/7] darwin-rebuild: remove code for macOS < 11 --- pkgs/nix-tools/darwin-rebuild.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/pkgs/nix-tools/darwin-rebuild.sh b/pkgs/nix-tools/darwin-rebuild.sh index 7824913d2..f945e6b40 100644 --- a/pkgs/nix-tools/darwin-rebuild.sh +++ b/pkgs/nix-tools/darwin-rebuild.sh @@ -22,15 +22,9 @@ showSyntax() { } sudo() { - # REMOVEME when support for macOS 10.13 is dropped - # macOS 10.13 does not support sudo --preserve-env so we make this conditional - if command sudo --help | grep -- --preserve-env= >/dev/null; then - # We use `env` before our command to ensure the preserved PATH gets checked - # when trying to resolve the command to execute - command sudo -H --preserve-env=PATH --preserve-env=SSH_CONNECTION env "$@" - else - command sudo -H "$@" - fi + # We use `env` before our command to ensure the preserved PATH gets checked + # when trying to resolve the command to execute + command sudo -H --preserve-env=PATH --preserve-env=SSH_CONNECTION env "$@" } # Parse the command line. From fe2fc038fd2a63f23bc646b0f3ce022b7c9b3129 Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 12 Jan 2025 17:27:10 +0000 Subject: [PATCH 7/7] defaults/universalaccess: remove docs for macOS < 11 --- modules/system/defaults/universalaccess.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/system/defaults/universalaccess.nix b/modules/system/defaults/universalaccess.nix index 8a2de90f8..996f23b6b 100644 --- a/modules/system/defaults/universalaccess.nix +++ b/modules/system/defaults/universalaccess.nix @@ -28,7 +28,6 @@ with lib; default = null; description = '' Disable transparency in the menu bar and elsewhere. - Requires macOS Yosemite or later. The default is false. ''; };