diff --git a/lib/customisation.nix b/lib/customisation.nix index 4de6f58a6aed..c233744e07ca 100644 --- a/lib/customisation.nix +++ b/lib/customisation.nix @@ -5,7 +5,7 @@ let intersectAttrs; inherit (lib) functionArgs isFunction mirrorFunctionArgs isAttrs setFunctionArgs - optionalAttrs attrNames filter elemAt concatStringsSep sort take length + optionalAttrs attrNames filter elemAt concatStringsSep sortOn take length filterAttrs optionalString flip pathIsDirectory head pipe isDerivation listToAttrs mapAttrs seq flatten deepSeq warnIf isInOldestRelease extends ; @@ -174,7 +174,7 @@ rec { # levenshteinAtMost is only fast for 2 or less. (filter (levenshteinAtMost 2 arg)) # Put strings with shorter distance first - (sort (x: y: levenshtein x arg < levenshtein y arg)) + (sortOn (levenshtein arg)) # Only take the first couple results (take 3) # Quote all entries diff --git a/lib/default.nix b/lib/default.nix index a2958e561cf3..35e31af364d8 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -91,7 +91,7 @@ let inherit (self.lists) singleton forEach foldr fold foldl foldl' imap0 imap1 concatMap flatten remove findSingle findFirst any all count optional optionals toList range replicate partition zipListsWith zipLists - reverseList listDfs toposort sort naturalSort compareLists take + reverseList listDfs toposort sort sortOn naturalSort compareLists take drop sublist last init crossLists unique allUnique intersectLists subtractLists mutuallyExclusive groupBy groupBy'; inherit (self.strings) concatStrings concatMapStrings concatImapStrings diff --git a/lib/lists.nix b/lib/lists.nix index a56667ec9c38..9397acf148fc 100644 --- a/lib/lists.nix +++ b/lib/lists.nix @@ -4,6 +4,7 @@ let inherit (lib.strings) toInt; inherit (lib.trivial) compare min id; inherit (lib.attrsets) mapAttrs; + inherit (lib.lists) sort; in rec { @@ -591,9 +592,15 @@ rec { the second argument. The returned list is sorted in an increasing order. The implementation does a quick-sort. + See also [`sortOn`](#function-library-lib.lists.sortOn), which applies the + default comparison on a function-derived property, and may be more efficient. + Example: - sort (a: b: a < b) [ 5 3 7 ] + sort (p: q: p < q) [ 5 3 7 ] => [ 3 5 7 ] + + Type: + sort :: (a -> a -> Bool) -> [a] -> [a] */ sort = builtins.sort or ( strictLess: list: @@ -612,6 +619,42 @@ rec { if len < 2 then list else (sort strictLess pivot.left) ++ [ first ] ++ (sort strictLess pivot.right)); + /* + Sort a list based on the default comparison of a derived property `b`. + + The items are returned in `b`-increasing order. + + **Performance**: + + The passed function `f` is only evaluated once per item, + unlike an unprepared [`sort`](#function-library-lib.lists.sort) using + `f p < f q`. + + **Laws**: + ```nix + sortOn f == sort (p: q: f p < f q) + ``` + + Example: + sortOn stringLength [ "aa" "b" "cccc" ] + => [ "b" "aa" "cccc" ] + + Type: + sortOn :: (a -> b) -> [a] -> [a], for comparable b + */ + sortOn = f: list: + let + # Heterogenous list as pair may be ugly, but requires minimal allocations. + pairs = map (x: [(f x) x]) list; + in + map + (x: builtins.elemAt x 1) + (sort + # Compare the first element of the pairs + # Do not factor out the `<`, to avoid calls in hot code; duplicate instead. + (a: b: head a < head b) + pairs); + /* Compare two lists element-by-element. Example: diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 9f1fee2ba234..608af656d02c 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -650,6 +650,28 @@ runTests { expected = [2 30 40 42]; }; + testSortOn = { + expr = sortOn stringLength [ "aa" "b" "cccc" ]; + expected = [ "b" "aa" "cccc" ]; + }; + + testSortOnEmpty = { + expr = sortOn (throw "nope") [ ]; + expected = [ ]; + }; + + testSortOnIncomparable = { + expr = + map + (x: x.f x.ok) + (sortOn (x: x.ok) [ + { ok = 1; f = x: x; } + { ok = 3; f = x: x + 3; } + { ok = 2; f = x: x; } + ]); + expected = [ 1 2 6 ]; + }; + testReplicate = { expr = replicate 3 "a"; expected = ["a" "a" "a"]; diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index aa09b1fe5e45..13fcc20ef3f3 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -18571,6 +18571,12 @@ githubId = 1486805; name = "Toon Nolten"; }; + tornax = { + email = "tornax@pm.me"; + github = "TornaxO7"; + githubId = 50843046; + name = "tornax"; + }; toschmidt = { email = "tobias.schmidt@in.tum.de"; github = "toschmidt"; diff --git a/nixos/modules/services/backup/btrbk.nix b/nixos/modules/services/backup/btrbk.nix index 1e90ef54d33f..3cbbf0f1bd5c 100644 --- a/nixos/modules/services/backup/btrbk.nix +++ b/nixos/modules/services/backup/btrbk.nix @@ -13,7 +13,7 @@ let mkIf mkOption optionalString - sort + sortOn types ; @@ -37,7 +37,7 @@ let genConfig = set: let pairs = mapAttrsToList (name: value: { inherit name value; }) set; - sortedPairs = sort (a: b: prioOf a < prioOf b) pairs; + sortedPairs = sortOn prioOf pairs; in concatMap genPair sortedPairs; genSection = sec: secName: value: diff --git a/pkgs/applications/audio/abcde/default.nix b/pkgs/applications/audio/abcde/default.nix index 1c5fc5718142..e688e0edccdf 100644 --- a/pkgs/applications/audio/abcde/default.nix +++ b/pkgs/applications/audio/abcde/default.nix @@ -30,7 +30,7 @@ in nativeBuildInputs = [ makeWrapper ]; - buildInputs = with perlPackages; [ perl MusicBrainz MusicBrainzDiscID ]; + buildInputs = with perlPackages; [ perl MusicBrainz MusicBrainzDiscID IOSocketSSL ]; installFlags = [ "sysconfdir=$(out)/etc" ]; diff --git a/pkgs/applications/networking/cluster/clusterctl/default.nix b/pkgs/applications/networking/cluster/clusterctl/default.nix index 30710a814652..9249b324202d 100644 --- a/pkgs/applications/networking/cluster/clusterctl/default.nix +++ b/pkgs/applications/networking/cluster/clusterctl/default.nix @@ -2,16 +2,16 @@ buildGoModule rec { pname = "clusterctl"; - version = "1.5.3"; + version = "1.6.0"; src = fetchFromGitHub { owner = "kubernetes-sigs"; repo = "cluster-api"; rev = "v${version}"; - hash = "sha256-yACUJY//y1nqu0PfmCuREC8k/koJEB6yPV5IXLnweB0="; + hash = "sha256-EzJl4BfjRFzj7Qq3bc7rQlD7D1xnb6zIr2wgeaZ9Dhk="; }; - vendorHash = "sha256-wOf9OWbqjxYJio57lMBdp77RG5hhRrVU75iJiI8g0EM="; + vendorHash = "sha256-wSjd40rvrtpsE+wF3u3b+IRehksJOuRLThLuYOOHaAY="; subPackages = [ "cmd/clusterctl" ]; diff --git a/pkgs/applications/networking/instant-messengers/beeper/default.nix b/pkgs/applications/networking/instant-messengers/beeper/default.nix index 2bb15a79b941..e09f3cc767f0 100644 --- a/pkgs/applications/networking/instant-messengers/beeper/default.nix +++ b/pkgs/applications/networking/instant-messengers/beeper/default.nix @@ -11,11 +11,11 @@ }: let pname = "beeper"; - version = "3.85.17"; + version = "3.89.3"; name = "${pname}-${version}"; src = fetchurl { - url = "https://download.todesktop.com/2003241lzgn20jd/beeper-3.85.17-build-231109zg8yl8v6s.AppImage"; - hash = "sha256-sYdfN535Fg3Bm26XKQNyuTItV+1dT3W/2HGH51ncEM0="; + url = "https://download.todesktop.com/2003241lzgn20jd/beeper-3.89.3-build-231206totezhepd.AppImage"; + hash = "sha256-o4mD2LcWnlw9EIuv0v//51uByaAAxKcJNz9mKjp/Jp8="; }; appimage = appimageTools.wrapType2 { inherit version pname src; diff --git a/pkgs/applications/networking/instant-messengers/zoom-us/default.nix b/pkgs/applications/networking/instant-messengers/zoom-us/default.nix index 10af3d3ea4d3..8eae0b8a0d25 100644 --- a/pkgs/applications/networking/instant-messengers/zoom-us/default.nix +++ b/pkgs/applications/networking/instant-messengers/zoom-us/default.nix @@ -48,23 +48,23 @@ let # and often with different versions. We write them on three lines # like this (rather than using {}) so that the updater script can # find where to edit them. - versions.aarch64-darwin = "5.16.6.24664"; - versions.x86_64-darwin = "5.16.6.24664"; - versions.x86_64-linux = "5.16.6.382"; + versions.aarch64-darwin = "5.16.10.25689"; + versions.x86_64-darwin = "5.16.10.25689"; + versions.x86_64-linux = "5.16.10.668"; srcs = { aarch64-darwin = fetchurl { url = "https://zoom.us/client/${versions.aarch64-darwin}/zoomusInstallerFull.pkg?archType=arm64"; name = "zoomusInstallerFull.pkg"; - hash = "sha256-5xccYYisVRZw7tJ6uri52BuaeURadaHypse4vjwPQIY="; + hash = "sha256-FIvUDbK1dwOdF8Y70Y3PHTxM/Kl5BMkmvNwcqbV+pog="; }; x86_64-darwin = fetchurl { url = "https://zoom.us/client/${versions.x86_64-darwin}/zoomusInstallerFull.pkg"; - hash = "sha256-N3jzvxoRY3W5fw1Fs0qevgHC+7cLLYvoGA/ZYiE71JA="; + hash = "sha256-z8nDNaJtSUtb/KeoxiSgU3HU/VY7JxGp9Ug5roD0y3U="; }; x86_64-linux = fetchurl { url = "https://zoom.us/client/${versions.x86_64-linux}/zoom_x86_64.pkg.tar.xz"; - hash = "sha256-2O8jGQHGyF5XLQUxHUWA3h9K792lRQmOC2mS0rTukSw="; + hash = "sha256-dZQHbpvU8uNafmHtGoPhj6WsDhO20Dma/XwY6oa3Xes="; }; }; diff --git a/pkgs/applications/terminal-emulators/rio/default.nix b/pkgs/applications/terminal-emulators/rio/default.nix index 0aeed26fb5be..37b37cae0faa 100644 --- a/pkgs/applications/terminal-emulators/rio/default.nix +++ b/pkgs/applications/terminal-emulators/rio/default.nix @@ -31,6 +31,8 @@ let rlinkLibs = if stdenv.isDarwin then [ darwin.libobjc darwin.apple_sdk_11_0.frameworks.AppKit + darwin.apple_sdk_11_0.frameworks.AVFoundation + darwin.apple_sdk_11_0.frameworks.Vision ] else [ (lib.getLib gcc-unwrapped) fontconfig @@ -49,16 +51,16 @@ let in rustPlatform.buildRustPackage rec { pname = "rio"; - version = "0.0.28"; + version = "0.0.29"; src = fetchFromGitHub { owner = "raphamorim"; repo = "rio"; rev = "v${version}"; - hash = "sha256-OkJYGX/yWOUb4cDwacDgDRgzc/fkAnNcCzUrHimiVgM="; + hash = "sha256-S+mqamTm8GHCyJF/L1V4XnhJDuhwo9n3Zf+UCKXg8p8="; }; - cargoHash = "sha256-vcIv3EGM8LEdg//FM/d+gDLLQFWukEE1/wfLVTXqN9w="; + cargoHash = "sha256-aKj3L1s+FgN8T4IrBuTAQyzfKOPgCt2R0C6+YIv56Zw="; nativeBuildInputs = [ ncurses @@ -112,7 +114,7 @@ rustPlatform.buildRustPackage rec { description = "A hardware-accelerated GPU terminal emulator powered by WebGPU"; homepage = "https://raphamorim.io/rio"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ otavio oluceps ]; + maintainers = with lib.maintainers; [ tornax otavio oluceps ]; platforms = lib.platforms.unix; changelog = "https://github.com/raphamorim/rio/blob/v${version}/CHANGELOG.md"; mainProgram = "rio"; diff --git a/pkgs/development/interpreters/python/default.nix b/pkgs/development/interpreters/python/default.nix index 5ffc5da59413..e4556d95f0fd 100644 --- a/pkgs/development/interpreters/python/default.nix +++ b/pkgs/development/interpreters/python/default.nix @@ -95,10 +95,10 @@ in { sourceVersion = { major = "3"; minor = "12"; - patch = "0"; + patch = "1"; suffix = ""; }; - hash = "sha256-eVw09E30Wg6blxDIxxwVxnGHFSTNQSyhTe8hLozLFV0="; + hash = "sha256-jfuPQm/NImZX+eK9Xx6W5TJkllF2+hfTJljoc1ka6yE="; inherit (darwin) configd; inherit passthruFun; }; diff --git a/pkgs/development/libraries/python-qt/default.nix b/pkgs/development/libraries/python-qt/default.nix index f0b7c8478e08..d238b8137d33 100644 --- a/pkgs/development/libraries/python-qt/default.nix +++ b/pkgs/development/libraries/python-qt/default.nix @@ -4,28 +4,19 @@ stdenv.mkDerivation rec { pname = "python-qt"; - version = "3.3.0"; + version = "3.4.2"; src = fetchFromGitHub { owner = "MeVisLab"; repo = "pythonqt"; rev = "v${version}"; - hash = "sha256-zbQ6X4Q2/QChaw3GAz/aVBj2JjWEz52YuPuHbBz935k="; + hash = "sha256-xJYOD07ACOKtY3psmfHNSCjm6t0fr8JU9CrL0w5P5G0="; }; - patches = [ - (fetchpatch { - name = "remove-unneeded-pydebug-include.patch"; - url = "https://github.com/MeVisLab/pythonqt/commit/a93104dea4d9c79351276ec963e931ca617625ec.patch"; - includes = [ "src/PythonQt.cpp" ]; - hash = "sha256-Tc4+6dIdvrda/z3Nz1s9Xz+ZWJLV2BQh8i552UynSI0="; - }) - ]; - # https://github.com/CsoundQt/CsoundQt/blob/develop/BUILDING.md#pythonqt postPatch = '' substituteInPlace build/python.prf \ - --replace "unix:PYTHON_VERSION=2.7" "unix:PYTHON_VERSION=${python.pythonVersion}" + --replace "PYTHON_VERSION=2.7" "PYTHON_VERSION=${python.pythonVersion}" ''; hardeningDisable = [ "all" ]; diff --git a/pkgs/development/tools/electron/binary/default.nix b/pkgs/development/tools/electron/binary/default.nix index eb4c354ba54a..0cdb42a3a0b8 100644 --- a/pkgs/development/tools/electron/binary/default.nix +++ b/pkgs/development/tools/electron/binary/default.nix @@ -175,4 +175,13 @@ rec { aarch64-darwin = "2fc319c53f6dc61e2e424d46712caead7022b5124c9674f3b15b45c556dd0623"; headers = "1pb8xhaarkmgss00ap4jbf693i03z4mwh5ilpkz6dsg1b9fka84q"; }; + + electron_28-bin = mkElectron "28.0.0" { + armv7l-linux = "e41686b6ce7be7efb74d1f3fb4c912be31506b51770ceffa4e66b94164dac5b8"; + aarch64-linux = "32f9f7592359cf8b341946b41d758466533bd7a2bc0dc316072a3a1af4b92d84"; + x86_64-linux = "d66b6774b886bd57519d49b9eb8e6e745b523519414a8819f67aa19f76e2b53c"; + x86_64-darwin = "a5fdc70519b2c17a708920af2b998fc067ff0a18ba9f97d690cfab6bac23bd7a"; + aarch64-darwin = "d64947fee370a3b111f170399969977959848f2a2f544a1ae5dc081fc2df75cf"; + headers = "1lrwc03ffrf4bi2faampkx7yg0iqsrcp86znp9fw6ajwdwgqsc81"; + }; } diff --git a/pkgs/development/tools/xc/default.nix b/pkgs/development/tools/xc/default.nix index 5233de5fd6ea..a00744af9f3e 100644 --- a/pkgs/development/tools/xc/default.nix +++ b/pkgs/development/tools/xc/default.nix @@ -2,13 +2,13 @@ buildGoModule rec { pname = "xc"; - version = "0.5.0"; + version = "0.6.0"; src = fetchFromGitHub { owner = "joerdav"; repo = pname; rev = "v${version}"; - sha256 = "sha256-cVTa2ot95Hcm+1V1QXnlxSL9OjmoQNR9nVUgW/rZhl0="; + sha256 = "sha256-0Er8MqAqKCyz928bdbYRO3D9sGZ/JJBrCXhlq9M2dEA="; }; vendorHash = "sha256-J4/a4ujM7A6bDwRlLCYt/PmJf6HZUmdYcJMux/3KyUI="; diff --git a/pkgs/development/tools/yarn-berry/default.nix b/pkgs/development/tools/yarn-berry/default.nix index e9ae6ef416a0..d52d6d27e880 100644 --- a/pkgs/development/tools/yarn-berry/default.nix +++ b/pkgs/development/tools/yarn-berry/default.nix @@ -39,5 +39,6 @@ stdenv.mkDerivation rec { license = licenses.bsd2; maintainers = with maintainers; [ ryota-ka thehedgeh0g ]; platforms = platforms.unix; + mainProgram = "yarn"; }; } diff --git a/pkgs/tools/security/cosign/default.nix b/pkgs/tools/security/cosign/default.nix index 3e8acc96f29e..0cdf5b0839ea 100644 --- a/pkgs/tools/security/cosign/default.nix +++ b/pkgs/tools/security/cosign/default.nix @@ -13,13 +13,13 @@ }: buildGoModule rec { pname = "cosign"; - version = "2.2.1"; + version = "2.2.2"; src = fetchFromGitHub { owner = "sigstore"; repo = pname; rev = "v${version}"; - hash = "sha256-J/CQonW/ICrNUSQXVZPMR+WACZYJH0eH6bXhdXE27TY="; + hash = "sha256-QZWF0ysZFu3rt8dIXb5uddyDhT2FfWUyder8YR2BtQc="; }; buildInputs = @@ -28,7 +28,7 @@ buildGoModule rec { nativeBuildInputs = [ pkg-config installShellFiles ]; - vendorHash = "sha256-RPwU6W6a9mnfriyz3ASvamZ3jEG6C2ug/MTp1Pahc/Q="; + vendorHash = "sha256-WeNRg3Nw2b6NiV8z7tGZIlWUHZxXuTG7MPF9DgfdmUQ="; subPackages = [ "cmd/cosign" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c45de8fe1f2b..245238b9a6ef 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18493,7 +18493,8 @@ with pkgs; electron_24-bin electron_25-bin electron_26-bin - electron_27-bin; + electron_27-bin + electron_28-bin; electron_10 = electron_10-bin; electron_11 = electron_11-bin; @@ -18513,7 +18514,7 @@ with pkgs; electron_25 = electron_25-bin; electron_26 = if lib.meta.availableOn stdenv.hostPlatform electron-source.electron_26 then electron-source.electron_26 else electron_26-bin; electron_27 = if lib.meta.availableOn stdenv.hostPlatform electron-source.electron_27 then electron-source.electron_27 else electron_27-bin; - electron_28 = electron-source.electron_28; + electron_28 = if lib.meta.availableOn stdenv.hostPlatform electron-source.electron_28 then electron-source.electron_28 else electron_28-bin; electron = electron_27; autobuild = callPackage ../development/tools/misc/autobuild { };