lilypond{,-unstable,-with-fonts}: refactor and move to pkgs/by-name

especially refactor updateScript

this shouldn't create any rebuilds
This commit is contained in:
quantenzitrone 2026-02-02 01:32:10 +01:00
parent 87444bffa0
commit 311ab4c226
No known key found for this signature in database
6 changed files with 41 additions and 64 deletions

View file

@ -0,0 +1,25 @@
{
lib,
fetchzip,
lilypond,
writeScript,
}:
lilypond.overrideAttrs (
finalAttrs: prevAttrs: {
version = "2.25.32";
src = fetchzip {
url = "https://lilypond.org/download/sources/v${lib.versions.majorMinor finalAttrs.version}/lilypond-${finalAttrs.version}.tar.gz";
hash = "sha256-j7Avb9WSy27yQCak3KV7OB24M+T76b/tLcLoINLSEbo=";
};
passthru.updateScript = writeScript "update-lilypond-unstable" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts curl
version="$(curl -s 'https://gitlab.com/lilypond/lilypond/-/raw/master/VERSION' | grep 'VERSION_DEVEL=' | cut -d= -f2)"
update-source-version lilypond-unstable "$version" \
--file=pkgs/by-name/li/lilypond-unstable/package.nix
'';
}
)

View file

@ -14,7 +14,11 @@ lib.appendToName "with-fonts" (symlinkJoin {
meta
;
paths = [ lilypond ] ++ openlilylib-fonts.all;
paths = [
lilypond
]
# relevant for lilypond-unstable-with-fonts
++ (openlilylib-fonts.override { inherit lilypond; }).all;
nativeBuildInputs = [ makeWrapper ];

View file

@ -40,9 +40,10 @@
metafont
]
),
writeScript,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "lilypond";
version = "2.24.4";
outputs = [
@ -51,7 +52,7 @@ stdenv.mkDerivation rec {
];
src = fetchzip {
url = "http://lilypond.org/download/sources/v${lib.versions.majorMinor version}/lilypond-${version}.tar.gz";
url = "http://lilypond.org/download/sources/v${lib.versions.majorMinor finalAttrs.version}/lilypond-${finalAttrs.version}.tar.gz";
hash = "sha256-UYdORvodrVchxslOxpMiXrAh7DtB9sWp9yqZU/jeB9Y=";
};
@ -120,10 +121,12 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
passthru.updateScript = {
command = [ ./update.sh ];
supportedFeatures = [ "commit" ];
};
passthru.updateScript = writeScript "update-lilypond" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts curl
version="$(curl -s 'https://gitlab.com/lilypond/lilypond/-/raw/master/VERSION' | grep 'VERSION_STABLE=' | cut -d= -f2)"
update-source-version lilypond "$version"
'';
# documentation makefile uses "out" for different purposes, hence we explicitly set it to an empty string
makeFlags = [ "out=" ];
@ -147,4 +150,4 @@ stdenv.mkDerivation rec {
FONTCONFIG_FILE = lib.optional stdenv.hostPlatform.isDarwin (makeFontsConf {
fontDirectories = [ freefont_ttf ];
});
}
})

View file

@ -1,21 +0,0 @@
{
lib,
fetchzip,
lilypond,
}:
lilypond.overrideAttrs (oldAttrs: rec {
version = "2.25.32";
src = fetchzip {
url = "https://lilypond.org/download/sources/v${lib.versions.majorMinor version}/lilypond-${version}.tar.gz";
hash = "sha256-j7Avb9WSy27yQCak3KV7OB24M+T76b/tLcLoINLSEbo=";
};
passthru.updateScript = {
command = [
./update.sh
"unstable"
];
supportedFeatures = [ "commit" ];
};
})

View file

@ -1,25 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl gnused nix
set -euo pipefail
if [ $# -gt 0 ] && [ "$1" = "unstable" ]; then
ATTR="lilypond-unstable"
FILE="$(dirname "${BASH_SOURCE[@]}")/unstable.nix"
QUERY="VERSION_DEVEL="
else
ATTR="lilypond"
FILE="$(dirname "${BASH_SOURCE[@]}")/default.nix"
QUERY="VERSION_STABLE="
fi
# update version
PREV=$(nix eval --raw -f default.nix $ATTR.version)
NEXT=$(curl -s 'https://gitlab.com/lilypond/lilypond/-/raw/master/VERSION' | grep "$QUERY" | cut -d= -f2)
sed -i "s|$PREV|$NEXT|" "$FILE"
echo "[{\"commitMessage\":\"$ATTR: $PREV -> $NEXT\"}]"
# update hash
PREV=$(nix eval --raw -f default.nix $ATTR.src.outputHash)
NEXT=$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $(nix-prefetch-url --type sha256 --unpack $(nix eval --raw -f default.nix $ATTR.src.url)))
sed -i "s|$PREV|$NEXT|" "$FILE"

View file

@ -12416,19 +12416,10 @@ with pkgs;
;
kops = kops_1_33;
lilypond = callPackage ../misc/lilypond { };
lilypond-unstable = callPackage ../misc/lilypond/unstable.nix { };
lilypond-unstable-with-fonts = callPackage ../misc/lilypond/with-fonts.nix {
lilypond-unstable-with-fonts = lilypond-with-fonts.override {
lilypond = lilypond-unstable;
openlilylib-fonts = openlilylib-fonts.override {
lilypond = lilypond-unstable;
};
};
lilypond-with-fonts = callPackage ../misc/lilypond/with-fonts.nix { };
openlilylib-fonts = recurseIntoAttrs (callPackage ../misc/lilypond/fonts.nix { });
nixDependencies = recurseIntoAttrs (