mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-22 22:33:46 +03:00
update-flake.nix: fix stable pkgs selection
In rare cases, the nixpkgs stable version of a package can be newer than in unstable nixpkgs. [1] When this happens, choose the newer stable version instead of the older unstable version. [1] E.g., when a package is updated in both nixpkgs stable and unstable, and nixpkgs stable is released before unstable.
This commit is contained in:
parent
1ba7ccc547
commit
96144fde81
@ -8,8 +8,8 @@ in rec {
|
||||
# stable = { bitcoind = "0.21.1"; ... };
|
||||
# unstable = { btcpayserver = "1.2.1"; ... };
|
||||
# }
|
||||
# A pinned pkg is added to `stable` if the stable and unstable pkg versions
|
||||
# are identical.
|
||||
# A pinned pkg is added to `stable` if its stable version is newer or
|
||||
# identical to the unstable version.
|
||||
versions = let
|
||||
pinned = flake.legacyPackages.x86_64-linux.pinned;
|
||||
pinnedPkgs = lib.filterAttrs (n: v: lib.isDerivation v) pinned;
|
||||
@ -17,7 +17,8 @@ in rec {
|
||||
unstable = pinned.pkgsUnstable;
|
||||
isStable = builtins.partition (pkgName:
|
||||
!(unstable ? "${pkgName}") ||
|
||||
((stable ? "${pkgName}") && stable.${pkgName}.version == unstable.${pkgName}.version)
|
||||
((stable ? "${pkgName}")
|
||||
&& (builtins.compareVersions stable.${pkgName}.version unstable.${pkgName}.version >= 0))
|
||||
) (builtins.attrNames pinnedPkgs);
|
||||
in {
|
||||
stable = lib.genAttrs isStable.right (pkgName: stable.${pkgName}.version);
|
||||
|
Loading…
Reference in New Issue
Block a user