Drop pinned nixpkgs inputs and the local lndinit
Take every package from the consumer's pkgs: bitcoind, lnd, electrs and lndinit (0.1.3 -> nixpkgs' version; gen-seed and init-wallet flags are unchanged). The flake now has a single nixpkgs input. Removes useVersionLockedPkgs, pinned.nix, nixpkgs-pinned.nix, shell.nix and the update-flake helper that generated pinned.nix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
{ prevVersions ? null }:
|
||||
let
|
||||
flake = builtins.getFlake (toString ../.);
|
||||
inherit (flake.inputs.nixpkgs) lib;
|
||||
in rec {
|
||||
# Convert the list of pinned pkgs to an attrset with form
|
||||
# {
|
||||
# stable = { bitcoind = "0.21.1"; ... };
|
||||
# unstable = { btcpayserver = "1.2.1"; ... };
|
||||
# }
|
||||
# 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;
|
||||
stable = pinned.pkgs;
|
||||
unstable = pinned.pkgsUnstable;
|
||||
isStable = builtins.partition (pkgName:
|
||||
!(unstable ? "${pkgName}") ||
|
||||
((stable ? "${pkgName}")
|
||||
&& (builtins.compareVersions stable.${pkgName}.version unstable.${pkgName}.version >= 0))
|
||||
) (builtins.attrNames pinnedPkgs);
|
||||
in {
|
||||
stable = lib.genAttrs isStable.right (pkgName: stable.${pkgName}.version);
|
||||
unstable = lib.genAttrs isStable.wrong (pkgName: unstable.${pkgName}.version);
|
||||
};
|
||||
|
||||
showUpdates = let
|
||||
prev = builtins.fromJSON prevVersions;
|
||||
prevPkgs = prev.stable // prev.unstable;
|
||||
mapFilter = f: xs: lib.remove null (map f xs);
|
||||
|
||||
mkChanges = title: pkgs:
|
||||
let
|
||||
lines = mapFilter (pkgName:
|
||||
let
|
||||
version = pkgs.${pkgName};
|
||||
prevVersion = prevPkgs.${pkgName};
|
||||
in
|
||||
if version != prevVersion then
|
||||
"${pkgName}: ${prevVersion} -> ${version}"
|
||||
else
|
||||
null
|
||||
) (builtins.attrNames pkgs);
|
||||
in
|
||||
if lines == [] then
|
||||
null
|
||||
else
|
||||
builtins.concatStringsSep "\n" ([title] ++ lines);
|
||||
|
||||
changes = [
|
||||
(mkChanges "Pkg updates in nixpkgs stable:" versions.stable)
|
||||
(mkChanges "Pkg updates in nixpkgs unstable:" versions.unstable)
|
||||
];
|
||||
|
||||
allChanges = builtins.concatStringsSep "\n\n" (lib.remove null changes);
|
||||
in
|
||||
if allChanges == "" then
|
||||
"No pkg version updates."
|
||||
else
|
||||
allChanges;
|
||||
|
||||
pinnedFile = let
|
||||
toLines = pkgs: builtins.concatStringsSep "\n " (builtins.attrNames pkgs);
|
||||
in ''
|
||||
# This file is generated by ../helper/update-flake.nix
|
||||
pkgs: pkgsUnstable: pkgs-25_05:
|
||||
{
|
||||
inherit (pkgs)
|
||||
${toLines versions.stable};
|
||||
|
||||
inherit (pkgsUnstable)
|
||||
${toLines versions.unstable};
|
||||
|
||||
inherit pkgs pkgsUnstable pkgs-25_05;
|
||||
}
|
||||
'';
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# This script does the following:
|
||||
# - When called without arguments, update all flake inputs, including nixpkgs.
|
||||
# - When called with a version argument, set input `nixpkgs` in `flake.nix` to the
|
||||
# specified version and only update this input.
|
||||
# - Print version updates of pinned pkgs like so:
|
||||
# Pkg updates in nixpkgs unstable:
|
||||
# bitcoin: 0.20.0 -> 0.21.1
|
||||
# btcpayserver: 1.1.0 -> 1.1.2
|
||||
# - Write ../pkgs/pinned.nix:
|
||||
# Packages for which the stable und unstable versions are identical are
|
||||
# pinned to stable.
|
||||
# All other pkgs are pinned to unstable.
|
||||
|
||||
forceRun=
|
||||
nixosVersion=
|
||||
for arg in "$@"; do
|
||||
case $arg in
|
||||
-f)
|
||||
forceRun=1
|
||||
;;
|
||||
*)
|
||||
nixosVersion=$arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# cd to script dir
|
||||
cd "${BASH_SOURCE[0]%/*}"
|
||||
|
||||
if [[ $(nix flake 2>&1) != *"requires a sub-command"* ]]; then
|
||||
echo "Error. This script requires nix flake support."
|
||||
echo "https://nixos.wiki/wiki/Flakes#Installing_flakes"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $forceRun ]] && ! git diff --quiet ../flake.{nix,lock}; then
|
||||
echo "error: flake.nix/flake.lock have changes. Run with option -f to ignore."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! $nixosVersion ]]; then
|
||||
echo "Updating flake 'nixos-search'"
|
||||
nix flake update --flake ../test/nixos-search
|
||||
echo
|
||||
fi
|
||||
|
||||
versions=$(nix eval --json -f update-flake.nix versions)
|
||||
|
||||
## Uncomment the following to generate a version change message for testing
|
||||
# versions=$(echo "$versions" | sed 's|1|0|g')
|
||||
|
||||
setVersion() {
|
||||
sed -Ei "s|($1)[0-9.]+|\1$nixosVersion|" "$2"
|
||||
}
|
||||
|
||||
echo "Updating main flake"
|
||||
if [[ $nixosVersion ]]; then
|
||||
setVersion 'nixpkgs.url = .*?nixos-' ../flake.nix
|
||||
setVersion 'system.stateVersion = "' ../examples/configuration.nix
|
||||
setVersion 'nix-bitcoin.url = .*?/nixos-' ../examples/flakes/flake.nix
|
||||
setVersion 'nix-bitcoin.url = .*?/nixos-' ../examples/container/flake.nix
|
||||
setVersion 'update-flake.sh ' ../dev/README.md
|
||||
nix flake update nixpkgs --flake ..
|
||||
else
|
||||
nix flake update --flake ..
|
||||
fi
|
||||
|
||||
echo
|
||||
nix eval --raw -f update-flake.nix --argstr prevVersions "$versions" showUpdates; echo
|
||||
|
||||
pinned=../pkgs/pinned.nix
|
||||
pinnedSrc=$(nix eval --raw -f update-flake.nix --argstr prevVersions "$versions" pinnedFile)
|
||||
if [[ $pinnedSrc != $(cat "$pinned") ]]; then
|
||||
echo "$pinnedSrc" > "$pinned"
|
||||
echo
|
||||
echo "Updated pinned.nix"
|
||||
fi
|
||||
Reference in New Issue
Block a user