Fixing an overload of "pname"
This commit is contained in:
parent
fc302bc07f
commit
603e84caef
@ -7,6 +7,7 @@
|
|||||||
{
|
{
|
||||||
name
|
name
|
||||||
, pname ? name
|
, pname ? name
|
||||||
|
, mainGemName ? null
|
||||||
, gemdir ? null
|
, gemdir ? null
|
||||||
, gemfile ? null
|
, gemfile ? null
|
||||||
, lockfile ? null
|
, lockfile ? null
|
||||||
@ -44,13 +45,13 @@ let
|
|||||||
|
|
||||||
copyIfBundledByPath = { bundledByPath ? false, ...}@main:
|
copyIfBundledByPath = { bundledByPath ? false, ...}@main:
|
||||||
(if bundledByPath then
|
(if bundledByPath then
|
||||||
assert gemFiles.gemdir != nil; "cp -a ${gemFiles.gemdir}/* $out/"
|
assert gemFiles.gemdir != null; "cp -a ${gemFiles.gemdir}/* $out/"
|
||||||
else ""
|
else ""
|
||||||
);
|
);
|
||||||
|
|
||||||
maybeCopyAll = pname: if pname == null then "" else
|
maybeCopyAll = pkgname: if pkgname == null then "" else
|
||||||
let
|
let
|
||||||
mainGem = gems."${pname}" or (throw "bundlerEnv: gem ${pname} not found");
|
mainGem = gems."${pkgname}" or (throw "bundlerEnv: gem ${pkgname} not found");
|
||||||
in
|
in
|
||||||
copyIfBundledByPath mainGem;
|
copyIfBundledByPath mainGem;
|
||||||
|
|
||||||
@ -59,7 +60,7 @@ let
|
|||||||
# out. Yes, I'm serious.
|
# out. Yes, I'm serious.
|
||||||
confFiles = runCommand "gemfile-and-lockfile" {} ''
|
confFiles = runCommand "gemfile-and-lockfile" {} ''
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
${maybeCopyAll pname}
|
${maybeCopyAll mainGemName}
|
||||||
cp ${gemFiles.gemfile} $out/Gemfile || ls -l $out/Gemfile
|
cp ${gemFiles.gemfile} $out/Gemfile || ls -l $out/Gemfile
|
||||||
cp ${gemFiles.lockfile} $out/Gemfile.lock || ls -l $out/Gemfile.lock
|
cp ${gemFiles.lockfile} $out/Gemfile.lock || ls -l $out/Gemfile.lock
|
||||||
'';
|
'';
|
||||||
|
@ -7,6 +7,8 @@ rec {
|
|||||||
, gemdir ? null
|
, gemdir ? null
|
||||||
, ...
|
, ...
|
||||||
}: {
|
}: {
|
||||||
|
inherit gemdir;
|
||||||
|
|
||||||
gemfile =
|
gemfile =
|
||||||
if gemfile == null then assert gemdir != null; gemdir + "/Gemfile"
|
if gemfile == null then assert gemdir != null; gemdir + "/Gemfile"
|
||||||
else gemfile;
|
else gemfile;
|
||||||
|
@ -27,7 +27,7 @@ let
|
|||||||
else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}"
|
else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}"
|
||||||
else throw "bundlerEnv: either pname or name must be set";
|
else throw "bundlerEnv: either pname or name must be set";
|
||||||
|
|
||||||
basicEnv = (callPackage ../bundled-common {}) (args // { inherit pname name; });
|
basicEnv = (callPackage ../bundled-common {}) (args // { inherit pname name; mainGemName = pname; });
|
||||||
|
|
||||||
inherit (basicEnv) envPaths;
|
inherit (basicEnv) envPaths;
|
||||||
# Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" -
|
# Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" -
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
{ lib, stdenv, callPackage, runCommand, ruby }@defs:
|
{ lib, stdenv, callPackage, runCommand, ruby }@defs:
|
||||||
|
|
||||||
|
# Use for simple installation of Ruby tools shipped in a Gem.
|
||||||
|
# Start with a Gemfile that includes `gem <toolgem>`
|
||||||
|
# > nix-shell -p bundler bundix
|
||||||
|
# (shell)> bundle lock
|
||||||
|
# (shell)> bundix
|
||||||
|
# Then use rubyTool in the default.nix:
|
||||||
|
|
||||||
|
# rubyTool { name = "gemifiedTool"; gemdir = ./.; exes = ["gemified-tool"]; }
|
||||||
|
# The 'exes' parameter ensures that a copy of e.g. rake doesn't polute the system.
|
||||||
{
|
{
|
||||||
name
|
name
|
||||||
# gemdir is the location of the Gemfile{,.lock} and gemset.nix; usually ./.
|
# gemdir is the location of the Gemfile{,.lock} and gemset.nix; usually ./.
|
||||||
@ -25,8 +34,8 @@ let
|
|||||||
// { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
|
// { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
|
||||||
in
|
in
|
||||||
runCommand name cmdArgs ''
|
runCommand name cmdArgs ''
|
||||||
mkdir -p $out/bin; cd $out;
|
mkdir -p $out/bin;
|
||||||
${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' '${x}';\n") exes)}
|
${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' $out/bin/${x};\n") exes)}
|
||||||
${(lib.concatMapStrings (s: "makeWrapper $out/bin/$(basename ${s}) $srcdir/${s} " +
|
${(lib.concatMapStrings (s: "makeWrapper $out/bin/$(basename ${s}) $srcdir/${s} " +
|
||||||
"--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+
|
"--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+
|
||||||
"--set BUNDLE_PATH ${basicEnv}/${ruby.gemPath} "+
|
"--set BUNDLE_PATH ${basicEnv}/${ruby.gemPath} "+
|
||||||
|
Loading…
x
Reference in New Issue
Block a user