chickenPackages.chickenEggs: Preserve version info (#433689)

This commit is contained in:
David McFarland 2025-08-14 18:44:50 -03:00 committed by GitHub
commit a885d5af08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 36 additions and 61 deletions

View File

@ -37,7 +37,7 @@ lib.makeScope newScope (self: {
...
}:
self.eggDerivation {
name = "${pname}-${version}";
inherit pname version;
src = self.fetchegg (eggData // { inherit pname; });
buildInputs = map (x: eggself.${x}) dependencies;
meta.homepage = "https://wiki.call-cc.org/eggref/5/${pname}";

View File

@ -5,12 +5,6 @@
chickenEggs,
}:
# Note: This mostly reimplements the default.nix already contained in
# the tarball. Is there a nicer way than duplicating code?
let
version = "c5-git";
in
eggDerivation {
src = fetchFromGitHub {
owner = "corngood";
@ -19,7 +13,8 @@ eggDerivation {
sha256 = "1vfnhbcnyakywgjafhs0k5kpsdnrinzvdjxpz3fkwas1jsvxq3d1";
};
name = "egg2nix-${version}";
pname = "egg2nix";
version = "c5-git";
buildInputs = with chickenEggs; [
args
matchable

View File

@ -6,7 +6,6 @@
makeWrapper,
}:
{
name,
src,
buildInputs ? [ ],
chickenInstallFlags ? [ ],
@ -15,14 +14,24 @@
}@args:
let
nameVersionAssertion =
pred: lib.assertMsg pred "either name or both pname and version must be given";
pname =
if args ? pname then
assert nameVersionAssertion (!args ? name && args ? version);
args.pname
else
assert nameVersionAssertion (args ? name && !args ? version);
lib.getName args.name;
version = if args ? version then args.version else lib.getVersion args.name;
name = if args ? name then args.name else "${args.pname}-${args.version}";
overrides = callPackage ./overrides.nix { };
baseName = lib.getName name;
override =
if builtins.hasAttr baseName overrides then builtins.getAttr baseName overrides else lib.id;
override = if builtins.hasAttr pname overrides then builtins.getAttr pname overrides else lib.id;
in
(stdenv.mkDerivation (
{
name = "chicken-${name}";
pname = "chicken-${pname}";
inherit version;
propagatedBuildInputs = buildInputs;
nativeBuildInputs = [
chicken
@ -47,6 +56,10 @@ in
export CHICKEN_INSTALL_REPOSITORY=$out/lib/chicken/${toString chicken.binaryVersion}
chicken-install -cached -host ${lib.escapeShellArgs chickenInstallFlags}
# Patching generated .egg-info instead of original .egg to work around https://bugs.call-cc.org/ticket/1855
csi -e "(write (cons '(version \"${version}\") (read)))" < "$CHICKEN_INSTALL_REPOSITORY/${pname}.egg-info" > "${pname}.egg-info.new"
mv "${pname}.egg-info.new" "$CHICKEN_INSTALL_REPOSITORY/${pname}.egg-info"
for f in $out/bin/*
do
wrapProgram $f \
@ -67,6 +80,8 @@ in
}
// builtins.removeAttrs args [
"name"
"pname"
"version"
"buildInputs"
"meta"
]

View File

@ -28,26 +28,6 @@ let
};
in
{
allegro =
old:
(
(addToBuildInputsWithPkgConfig (
[
pkgs.allegro5
pkgs.libglvnd
pkgs.libGLU
]
++ lib.optionals stdenv.hostPlatform.isLinux [ pkgs.xorg.libX11 ]
))
old
)
// {
# depends on 'chicken' egg, which doesn't exist,
# so we specify all the deps here
propagatedBuildInputs = [
chickenEggs.foreigners
];
};
breadline = addToBuildInputs pkgs.readline;
blas = addToBuildInputsWithPkgConfig pkgs.blas;
blosc = addToBuildInputs pkgs.c-blosc;
@ -60,13 +40,6 @@ in
srfi-13
]) old);
cmark = addToBuildInputs pkgs.cmark;
comparse = old: {
# For some reason lazy-seq 2 gets interpreted as lazy-seq 0.0.0??
postPatch = ''
substituteInPlace comparse.egg \
--replace-fail 'lazy-seq "0.1.0"' 'lazy-seq "0.0.0"'
'';
};
epoxy =
old:
(addToPropagatedBuildInputsWithPkgConfig pkgs.libepoxy old)
@ -122,14 +95,8 @@ in
(addToBuildInputs (lib.optional stdenv.hostPlatform.isDarwin pkgs.libinotify-kqueue) old)
// lib.optionalAttrs stdenv.hostPlatform.isDarwin (addToCscOptions "-L -linotify" old);
leveldb = addToBuildInputs pkgs.leveldb;
lowdown = old: {
# For some reason comparse version gets interpreted as 0.0.0
postPatch = ''
substituteInPlace lowdown.egg \
--replace-fail 'comparse "3"' 'comparse "0.0.0"'
'';
};
magic = addToBuildInputs pkgs.file;
magic-pipes = addToBuildInputs pkgs.chickenPackages_5.chickenEggs.regex;
mdh =
old:
(addToBuildInputs pkgs.pcre old)
@ -139,13 +106,6 @@ in
"-Wno-error=implicit-int"
];
};
medea = old: {
# For some reason comparse gets interpreted as comparse 0.0.0
postPatch = ''
substituteInPlace medea.egg \
--replace-fail 'comparse "0.3.0"' 'comparse "0.0.0"'
'';
};
# missing dependency in upstream egg
mistie = addToPropagatedBuildInputs (with chickenEggs; [ srfi-1 ]);
mosquitto = addToPropagatedBuildInputs ([ pkgs.mosquitto ]);
@ -286,12 +246,19 @@ in
};
# mark broken
"ephem-v1.1" = broken;
F-operator = broken;
atom = broken;
begin-syntax = broken;
allegro =
old:
(broken old)
// {
# depends on 'chicken' egg, which doesn't exist, so we specify all the deps here (needs to be
# kept around even when marked as broken so that evaluation doesn't break due to the missing
# attribute).
propagatedBuildInputs = [
chickenEggs.foreigners
];
};
ephem = broken;
canvas-draw = broken;
chicken-doc-admin = broken;
coops-utils = broken;
crypt = broken;
hypergiant = broken;
@ -301,10 +268,8 @@ in
mpi = broken;
pyffi = broken;
qt-light = broken;
salmonella-html-report = broken;
sundials = broken;
svn-client = broken;
system = broken;
tokyocabinet = broken;
# mark broken darwin