From 50b6dbcc04da13d39e31ec3427b2f290aa092b87 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 25 Jul 2024 18:53:17 +0300 Subject: [PATCH 1/8] treewide: Rename android `sdkVer` and `ndkVer` `sdkVer` conflicts with the old `sdkVer`(now `darwinSdkVersion` but that still uses `sdkVer` if set) used by darwin This shouldn't be an issue but due to `pkgs/development/interpreters/python/cpython/default.nix` running `lib.filterAttrs (n: v: ! lib.isDerivation v && n != "passthruFun")` on it's inputs (2 of them are darwin only) the `throw "Unsupported sdk...` in `pkgs/top-level/darwin-packages.nix` will be triggered. After this change `pkgsCross.armv7a-android-prebuilt.python3.pythonOnBuildForHost` won't fail with `error: Unsupported sdk: 33` Issue was bisected to 3cb23cec239d4f73bb1b51f26ac7599384fdadd6 --- lib/systems/examples.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 178536efb..d582ecba2 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -60,23 +60,21 @@ rec { armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; rust.rustcTarget = "armv7-linux-androideabi"; - sdkVer = "33"; - ndkVer = "26"; useAndroidPrebuilt = true; } // platforms.armv7a-android; aarch64-android-prebuilt = { config = "aarch64-unknown-linux-android"; rust.rustcTarget = "aarch64-linux-android"; - sdkVer = "33"; - ndkVer = "26"; + androidSdkVersion = "33"; + androidNdkVersion = "26"; useAndroidPrebuilt = true; }; aarch64-android = { config = "aarch64-unknown-linux-android"; - sdkVer = "33"; - ndkVer = "26"; + androidSdkVersion = "33"; + androidNdkVersion = "26"; libc = "bionic"; useAndroidPrebuilt = false; useLLVM = true; From 18042a8a2e4b83533b45fce13f5a096616313533 Mon Sep 17 00:00:00 2001 From: Artturin Date: Thu, 25 Jul 2024 20:09:42 +0300 Subject: [PATCH 2/8] lib.systems: throw if `sdkVer` or `ndkVer` are used for android. Those attrs have been renamed and throwing is the best way to show it, if we only warned then the user would only get an error like this `error: Unsupported sdk: 33` from `pkgs/top-level/darwin-packages.nix`. If someone wants to support multiple NixOS versions then they can simply set both attrs. (`!args ? androidSdkVersion` is for that) --- lib/systems/default.nix | 16 ++++++++++++++++ lib/systems/examples.nix | 2 ++ 2 files changed, 18 insertions(+) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 0b8aeda20..65b85c844 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -257,6 +257,22 @@ let if final.isMacOS then "MACOSX_DEPLOYMENT_TARGET" else if final.isiOS then "IPHONEOS_DEPLOYMENT_TARGET" else null; + + # Remove before 25.05 + androidSdkVersion = + if (args ? sdkVer && !args ? androidSdkVersion) then + throw "For android `sdkVer` has been renamed to `androidSdkVersion`" + else if (args ? androidSdkVersion) then + args.androidSdkVersion + else + null; + androidNdkVersion = + if (args ? ndkVer && !args ? androidNdkVersion) then + throw "For android `ndkVer` has been renamed to `androidNdkVersion`" + else if (args ? androidSdkVersion) then + args.androidNdkVersion + else + null; } // ( let selectEmulator = pkgs: diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index d582ecba2..971f6b873 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -60,6 +60,8 @@ rec { armv7a-android-prebuilt = { config = "armv7a-unknown-linux-androideabi"; rust.rustcTarget = "armv7-linux-androideabi"; + androidSdkVersion = "33"; + androidNdkVersion = "26"; useAndroidPrebuilt = true; } // platforms.armv7a-android; From 60035bc2eddd10a9045d9bb7a186f073aa579313 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 12 Aug 2024 12:52:26 +0200 Subject: [PATCH 3/8] lib/tests/modules.sh: Report failure source location --- lib/tests/modules.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 280d0b47d..06713ec3e 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -20,6 +20,15 @@ cd "$DIR"/modules pass=0 fail=0 +# prints the location of the call of to the function that calls it +loc() { + local caller depth + depth=1 + # ( lineno fnname file ) of the caller + caller=( $(caller $depth) ) + echo "${caller[2]}:${caller[0]}" +} + evalConfig() { local attr=$1 shift @@ -42,6 +51,7 @@ checkConfigOutput() { if evalConfig "$@" 2>/dev/null | grep -E --silent "$outputContains" ; then ((++pass)) else + echo "test failure at $(loc):" echo 2>&1 "error: Expected result matching '$outputContains', while evaluating" reportFailure "$@" fi @@ -52,12 +62,14 @@ checkConfigError() { local err="" shift if err="$(evalConfig "$@" 2>&1 >/dev/null)"; then + echo "test failure at $(loc):" echo 2>&1 "error: Expected error code, got exit code 0, while evaluating" reportFailure "$@" else if echo "$err" | grep -zP --silent "$errorContains" ; then ((++pass)) else + echo "test failure at $(loc):" echo 2>&1 "error: Expected error matching '$errorContains', while evaluating" reportFailure "$@" fi From 0e8ecc95e285b8aca02f6140aa80f11cdc49318f Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 12 Aug 2024 13:15:50 +0200 Subject: [PATCH 4/8] lib/tests/modules.sh: Do not redirect diagnostics to stdout It still prints its own diagnostics to stdout, but it's always done that. --- lib/tests/modules.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 06713ec3e..7dcfa5231 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -13,7 +13,7 @@ set -o errexit -o noclobber -o nounset -o pipefail shopt -s failglob inherit_errexit # https://stackoverflow.com/a/246128/6605742 -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" cd "$DIR"/modules @@ -40,7 +40,7 @@ reportFailure() { local attr=$1 shift local script="import ./default.nix { modules = [ $* ];}" - echo 2>&1 "$ nix-instantiate -E '$script' -A '$attr' --eval-only --json" + echo "$ nix-instantiate -E '$script' -A '$attr' --eval-only --json" evalConfig "$attr" "$@" || true ((++fail)) } @@ -52,7 +52,7 @@ checkConfigOutput() { ((++pass)) else echo "test failure at $(loc):" - echo 2>&1 "error: Expected result matching '$outputContains', while evaluating" + echo "error: Expected result matching '$outputContains', while evaluating" reportFailure "$@" fi } @@ -63,14 +63,14 @@ checkConfigError() { shift if err="$(evalConfig "$@" 2>&1 >/dev/null)"; then echo "test failure at $(loc):" - echo 2>&1 "error: Expected error code, got exit code 0, while evaluating" + echo "error: Expected error code, got exit code 0, while evaluating" reportFailure "$@" else if echo "$err" | grep -zP --silent "$errorContains" ; then ((++pass)) else echo "test failure at $(loc):" - echo 2>&1 "error: Expected error matching '$errorContains', while evaluating" + echo "error: Expected error matching '$errorContains', while evaluating" reportFailure "$@" fi fi From 3b2cc30e7a28b36894a22a895e377b08a3cb746c Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 12 Aug 2024 13:25:30 +0200 Subject: [PATCH 5/8] lib/tests/modules.sh: Add loc optional parameter --- lib/tests/modules.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index 7dcfa5231..e7c7f8813 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -20,10 +20,16 @@ cd "$DIR"/modules pass=0 fail=0 -# prints the location of the call of to the function that calls it +# loc +# prints the location of the call of to the function that calls it +# loc n +# prints the location n levels up the call stack loc() { local caller depth depth=1 + if [[ $# -gt 0 ]]; then + depth=$1 + fi # ( lineno fnname file ) of the caller caller=( $(caller $depth) ) echo "${caller[2]}:${caller[0]}" From f03a13314cd5871022070148c06bb38d1eddadab Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 12 Aug 2024 13:36:13 +0200 Subject: [PATCH 6/8] lib/tests/modules.sh: Improve failure log format - Clear separation between failures - Move error regex close to error message, which is at the bottom of a fairly long trace - Move most relevant and consistent info to bottom of terminal: the location of the failure. Some editors including vscode heuristically resolve file paths on Ctrl+click. - Less wordy - easy to glance - Capitalized prefixes to distinguish from Nix's own logging --- lib/tests/modules.sh | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index e7c7f8813..3a23766a1 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -35,6 +35,22 @@ loc() { echo "${caller[2]}:${caller[0]}" } +line() { + echo "----------------------------------------" +} +logStartFailure() { + line +} +logEndFailure() { + line + echo +} + +logFailure() { + # bold red + printf '\033[1;31mTEST FAILED\033[0m at %s\n' "$(loc 2)" +} + evalConfig() { local attr=$1 shift @@ -57,9 +73,12 @@ checkConfigOutput() { if evalConfig "$@" 2>/dev/null | grep -E --silent "$outputContains" ; then ((++pass)) else - echo "test failure at $(loc):" - echo "error: Expected result matching '$outputContains', while evaluating" + logStartFailure + echo "ACTUAL:" reportFailure "$@" + echo "EXPECTED: result matching '$outputContains'" + logFailure + logEndFailure fi } @@ -68,16 +87,22 @@ checkConfigError() { local err="" shift if err="$(evalConfig "$@" 2>&1 >/dev/null)"; then - echo "test failure at $(loc):" - echo "error: Expected error code, got exit code 0, while evaluating" + logStartFailure + echo "ACTUAL: exit code 0, output:" reportFailure "$@" + echo "EXPECTED: non-zero exit code" + logFailure + logEndFailure else if echo "$err" | grep -zP --silent "$errorContains" ; then ((++pass)) else - echo "test failure at $(loc):" - echo "error: Expected error matching '$errorContains', while evaluating" + logStartFailure + echo "ACTUAL:" reportFailure "$@" + echo "EXPECTED: error matching '$errorContains'" + logFailure + logEndFailure fi fi } From a10da5ee0a9092d88a32479787fea4cc52d365ca Mon Sep 17 00:00:00 2001 From: Salar Rahmanian Date: Fri, 16 Aug 2024 23:32:01 -0700 Subject: [PATCH 7/8] vscode-extensions.databricks.databricks: init at 2.3.1 --- lib/licenses.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/licenses.nix b/lib/licenses.nix index 67744b499..9b25bd4bc 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -728,6 +728,12 @@ lib.mapAttrs mkLicense ({ redistributable = false; }; + databricks-license = { + fullName = "Databricks License"; + url = "https://www.databricks.com/legal/db-license"; + free = false; + }; + fair = { fullName = "Fair License"; spdxId = "Fair"; From 7dda594730869587f06c38c946cb9ec7146666e8 Mon Sep 17 00:00:00 2001 From: Kazuki Okamoto Date: Sat, 17 Aug 2024 16:47:58 +0900 Subject: [PATCH 8/8] just fix markup --- lib/customisation.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/customisation.nix b/lib/customisation.nix index 0e0d79120..bcdc94f3c 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -455,7 +455,7 @@ rec { 1. Takes a function `p`, or a path to a Nix file that contains a function `p`, which takes an attribute set and returns value of arbitrary type `a`, 2. Takes an attribute set `args` with explicit attributes to pass to `p`, - 3. Calls `f` with attributes from the original attribute set `attrs` passed to `newScope` updated with `args, i.e. `attrs // args`, if they match the attributes in the argument of `p`. + 3. Calls `f` with attributes from the original attribute set `attrs` passed to `newScope` updated with `args`, i.e. `attrs // args`, if they match the attributes in the argument of `p`. All such functions `p` will be called with the same value for `attrs`.