···99 examples = import ./examples.nix { inherit lib; };
1010 architectures = import ./architectures.nix { inherit lib; };
11111212+ /*
1313+ Elaborated systems contain functions, which means that they don't satisfy
1414+ `==` for a lack of reflexivity.
1515+1616+ They might *appear* to satisfy `==` reflexivity when the same exact value is
1717+ compared to itself, because object identity is used as an "optimization";
1818+ compare the value with a reconstruction of itself, e.g. with `f == a: f a`,
1919+ or perhaps calling `elaborate` twice, and one will see reflexivity fail as described.
2020+2121+ Hence a custom equality test.
2222+2323+ Note that this does not canonicalize the systems, so you'll want to make sure
2424+ both arguments have been `elaborate`-d.
2525+ */
2626+ equals =
2727+ let removeFunctions = a: lib.filterAttrs (_: v: !builtins.isFunction v) a;
2828+ in a: b: removeFunctions a == removeFunctions b;
2929+3030+ /*
3131+ Try to convert an elaborated system back to a simple string. If not possible,
3232+ return null. So we have the property:
3333+3434+ sys: _valid_ sys ->
3535+ sys == elaborate (toLosslessStringMaybe sys)
3636+3737+ NOTE: This property is not guaranteed when `sys` was elaborated by a different
3838+ version of Nixpkgs.
3939+ */
4040+ toLosslessStringMaybe = sys:
4141+ if lib.isString sys then sys
4242+ else if equals sys (elaborate sys.system) then sys.system
4343+ else null;
4444+1245 /* List of all Nix system doubles the nixpkgs flake will expose the package set
1346 for. All systems listed here must be supported by nixpkgs as `localSystem`.
1447
···11-# We assert that the new algorithmic way of generating these lists matches the
22-# way they were hard-coded before.
11+# Run:
22+# [nixpkgs]$ nix-instantiate --eval --strict lib/tests/systems.nix
33+# Expected output: [], or the failed cases
34#
44-# One might think "if we exhaustively test, what's the point of procedurally
55-# calculating the lists anyway?". The answer is one can mindlessly update these
66-# tests as new platforms become supported, and then just give the diff a quick
77-# sanity check before committing :).
55+# OfBorg runs (approximately) nix-build lib/tests/release.nix
86let
97 lib = import ../default.nix;
108 mseteq = x: y: {
···1210 expected = lib.sort lib.lessThan y;
1311 };
1412in
1515-with lib.systems.doubles; lib.runTests {
1313+lib.runTests (
1414+# We assert that the new algorithmic way of generating these lists matches the
1515+# way they were hard-coded before.
1616+#
1717+# One might think "if we exhaustively test, what's the point of procedurally
1818+# calculating the lists anyway?". The answer is one can mindlessly update these
1919+# tests as new platforms become supported, and then just give the diff a quick
2020+# sanity check before committing :).
2121+2222+(with lib.systems.doubles; {
1623 testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ mmix ++ js ++ genode ++ redox);
17241825 testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-netbsd" "armv6l-none" "armv7a-linux" "armv7a-netbsd" "armv7l-linux" "armv7l-netbsd" "arm-none" "armv7a-darwin" ];
···3946 testopenbsd = mseteq openbsd [ "i686-openbsd" "x86_64-openbsd" ];
4047 testwindows = mseteq windows [ "i686-cygwin" "x86_64-cygwin" "i686-windows" "x86_64-windows" ];
4148 testunix = mseteq unix (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ cygwin ++ redox);
4949+})
5050+5151+// {
5252+ test_equals_example_x86_64-linux = {
5353+ expr = lib.systems.equals (lib.systems.elaborate "x86_64-linux") (lib.systems.elaborate "x86_64-linux");
5454+ expected = true;
5555+ };
5656+5757+ test_toLosslessStringMaybe_example_x86_64-linux = {
5858+ expr = lib.systems.toLosslessStringMaybe (lib.systems.elaborate "x86_64-linux");
5959+ expected = "x86_64-linux";
6060+ };
6161+ test_toLosslessStringMaybe_fail = {
6262+ expr = lib.systems.toLosslessStringMaybe (lib.systems.elaborate "x86_64-linux" // { something = "extra"; });
6363+ expected = null;
6464+ };
4265}
6666+6767+# Generate test cases to assert that a change in any non-function attribute makes a platform unequal
6868+// lib.concatMapAttrs (platformAttrName: origValue: {
6969+7070+ ${"test_equals_unequal_${platformAttrName}"} =
7171+ let modified =
7272+ assert origValue != arbitraryValue;
7373+ lib.systems.elaborate "x86_64-linux" // { ${platformAttrName} = arbitraryValue; };
7474+ arbitraryValue = x: "<<modified>>";
7575+ in {
7676+ expr = lib.systems.equals (lib.systems.elaborate "x86_64-linux") modified;
7777+ expected = {
7878+ # Changes in these attrs are not detectable because they're function.
7979+ # The functions should be derived from the data, so this is not a problem.
8080+ canExecute = null;
8181+ emulator = null;
8282+ emulatorAvailable = null;
8383+ isCompatible = null;
8484+ }?${platformAttrName};
8585+ };
8686+8787+}) (lib.systems.elaborate "x86_64-linux" /* arbitrary choice, just to get all the elaborated attrNames */)
8888+8989+)
···868868 # to match multiline regexes.
869869 console = io.StringIO()
870870871871- def console_matches() -> bool:
871871+ def console_matches(_: Any) -> bool:
872872 nonlocal console
873873 try:
874874 # This will return as soon as possible and
···884884 if timeout is not None:
885885 retry(console_matches, timeout)
886886 else:
887887- while not console_matches():
887887+ while not console_matches(False):
888888 pass
889889890890 def send_key(
···11---- ./ci/build/build-vscode.sh
22-+++ ./ci/build/build-vscode.sh
33-@@ -45,14 +45,12 @@
44- # Set the commit Code will embed into the product.json. We need to do this
55- # since Code tries to get the commit from the `.git` directory which will fail
66- # as it is a submodule.
77-- export VSCODE_DISTRO_COMMIT
88-- VSCODE_DISTRO_COMMIT=$(git rev-parse HEAD)
99-+ export VSCODE_DISTRO_COMMIT=none
1010-1111- # Add the date, our name, links, and enable telemetry (this just makes
11+diff --git a/ci/build/build-vscode.sh b/ci/build/build-vscode.sh
22+index a72549fb..3aed1ad5 100755
33+--- a/ci/build/build-vscode.sh
44++++ b/ci/build/build-vscode.sh
55+@@ -58,7 +58,6 @@ main() {
126 # telemetry available; telemetry can still be disabled by flag or setting).
137 # This needs to be done before building as Code will read this file and embed
148 # it into the client-side code.
···1610 cp product.json product.original.json # Since jq has no inline edit.
1711 jq --slurp '.[0] * .[1]' product.original.json <(
1812 cat << EOF
1919-@@ -99,7 +97,6 @@
1313+@@ -105,7 +104,6 @@ EOF
2014 # Reset so if you develop after building you will not be stuck with the wrong
2115 # commit (the dev client will use `oss-dev` but the dev server will still use
2216 # product.json which will have `stable-$commit`).
···2233let
44 # These settings are found in the Makefile, but there seems to be no
55- # way to select one ore the other setting other than editing the file
55+ # way to select one or the other setting other than editing the file
66 # manually, so we have to duplicate the know how here.
77 systemFlags = lib.optionalString stdenv.isDarwin ''
88 CFLAGS="-O2 -Wall -fomit-frame-pointer -no-cpp-precomp"
···1818in
1919stdenv.mkDerivation rec {
2020 pname = "tree";
2121- version = "2.0.4";
2121+ version = "2.1.1";
22222323 src = fetchFromGitLab {
2424 owner = "OldManProgrammer";
2525 repo = "unix-tree";
2626 rev = version;
2727- sha256 = "sha256-2voXL31JHh09yBBLuHhYyZsUapiPVF/cgRmTU6wSXk4=";
2727+ sha256 = "sha256-aPz1ROUeAKDmMjEtAaL2AguF54/CbIYWpL4Qovv2ftQ=";
2828 };
29293030 preConfigure = ''