bundler-{app,env}: expose pname and version in derivation (#356307)

This commit is contained in:
Philip Taron
2024-11-25 09:48:00 -08:00
committed by GitHub
3 changed files with 15 additions and 8 deletions
+3 -1
View File
@@ -51,6 +51,8 @@ lib.makeOverridable
, passthru ? {}
, meta ? {}
, pname ? null
, version ? null
}:
let
chosenOutputs = map (drv: {
@@ -78,7 +80,7 @@ in runCommand name
rec {
inherit manifest ignoreCollisions checkCollisionContents passthru
meta pathsToLink extraPrefix postBuild
nativeBuildInputs buildInputs;
nativeBuildInputs buildInputs pname version;
pkgs = builtins.toJSON chosenOutputs;
extraPathsFrom = lib.optional includeClosures (writeClosure pathsForClosure);
preferLocalBuild = true;
@@ -11,6 +11,7 @@
{
name ? null
, pname ? null
, version ? null
, mainGemName ? null
, gemdir ? null
, gemfile ? null
@@ -65,14 +66,16 @@ let
gems = lib.flip lib.mapAttrs configuredGemset (name: attrs: buildGem name attrs);
version' = if version != null then
version
else if pname != null then
gems.${pname}.suffix
else null;
name' = if name != null then
name
else
let
gem = gems.${pname};
suffix = gem.suffix;
in
"${pname}-${suffix}";
"${pname}-${version'}";
pname' = if pname != null then
pname
@@ -117,9 +120,10 @@ let
basicEnvArgs = {
inherit nativeBuildInputs buildInputs ignoreCollisions;
inherit nativeBuildInputs buildInputs ignoreCollisions pname;
name = name';
version = version';
paths = envPaths;
pathsToLink = [ "/lib" ];
@@ -39,8 +39,9 @@ let
inherit ruby;
}) args;
cmdArgs = removeAttrs args [ "pname" "postBuild" "gemConfig" "passthru" "gemset" "gemdir" ] // {
cmdArgs = removeAttrs args [ "postBuild" "gemConfig" "passthru" "gemset" "gemdir" ] // {
inherit preferLocalBuild allowSubstitutes; # pass the defaults
inherit (basicEnv) version;
nativeBuildInputs = nativeBuildInputs ++ lib.optionals (scripts != []) [ makeWrapper ];