git.iko.soy/typeable/nixpkgs
on master help sign in
Fixing an overload of "pname"
commit603e84caefe2be319263ad6f83637af533834cc9 authorJudson <nyarly@gmail.com> dateSun 25 Jun 2017, 17:40 (9 years ago) parentfc302bc
4 files changed+19−7
pkgs/development/ruby-modules/bundled-common/default.nix+5−4 pkgs/development/ruby-modules/bundled-common/functions.nix+2 pkgs/development/ruby-modules/bundler-env/default.nix+1−1 pkgs/development/ruby-modules/tool/default.nix+11−2
pkgs/development/ruby-modules/bundled-common/default.nix+5−4
@@ -7,6 +7,7 @@
77{
88 name
99, pname ? name
10+, mainGemName ? null
1011, gemdir ? null
1112, gemfile ? null
1213, lockfile ? null
@@ -44,13 +45,13 @@ let
4445
4546 copyIfBundledByPath = { bundledByPath ? false, ...}@main:
4647 (if bundledByPath then
47− assert gemFiles.gemdir != nil; "cp -a ${gemFiles.gemdir}/* $out/"
48+ assert gemFiles.gemdir != null; "cp -a ${gemFiles.gemdir}/* $out/"
4849 else ""
4950 );
5051
51− maybeCopyAll = pname: if pname == null then "" else
52+ maybeCopyAll = pkgname: if pkgname == null then "" else
5253 let
53− mainGem = gems."${pname}" or (throw "bundlerEnv: gem ${pname} not found");
54+ mainGem = gems."${pkgname}" or (throw "bundlerEnv: gem ${pkgname} not found");
5455 in
5556 copyIfBundledByPath mainGem;
5657
@@ -59,7 +60,7 @@ let
5960 # out. Yes, I'm serious.
6061 confFiles = runCommand "gemfile-and-lockfile" {} ''
6162 mkdir -p $out
62− ${maybeCopyAll pname}
63+ ${maybeCopyAll mainGemName}
6364 cp ${gemFiles.gemfile} $out/Gemfile || ls -l $out/Gemfile
6465 cp ${gemFiles.lockfile} $out/Gemfile.lock || ls -l $out/Gemfile.lock
6566 '';
pkgs/development/ruby-modules/bundled-common/functions.nix+2
@@ -7,6 +7,8 @@ rec {
77 , gemdir ? null
88 , ...
99 }: {
10+ inherit gemdir;
11+
1012 gemfile =
1113 if gemfile == null then assert gemdir != null; gemdir + "/Gemfile"
1214 else gemfile;
pkgs/development/ruby-modules/bundler-env/default.nix+1−1
@@ -27,7 +27,7 @@ let
2727 else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}"
2828 else throw "bundlerEnv: either pname or name must be set";
2929
30− basicEnv = (callPackage ../bundled-common {}) (args // { inherit pname name; });
30+ basicEnv = (callPackage ../bundled-common {}) (args // { inherit pname name; mainGemName = pname; });
3131
3232 inherit (basicEnv) envPaths;
3333 # Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" -
pkgs/development/ruby-modules/tool/default.nix+11−2
@@ -1,5 +1,14 @@
11{ lib, stdenv, callPackage, runCommand, ruby }@defs:
22
3+# Use for simple installation of Ruby tools shipped in a Gem.
4+# Start with a Gemfile that includes `gem <toolgem>`
5+# > nix-shell -p bundler bundix
6+# (shell)> bundle lock
7+# (shell)> bundix
8+# Then use rubyTool in the default.nix:
9+
10+# rubyTool { name = "gemifiedTool"; gemdir = ./.; exes = ["gemified-tool"]; }
11+# The 'exes' parameter ensures that a copy of e.g. rake doesn't polute the system.
312{
413 name
514 # gemdir is the location of the Gemfile{,.lock} and gemset.nix; usually ./.
@@ -25,8 +34,8 @@ let
2534 // { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults
2635in
2736 runCommand name cmdArgs ''
28− mkdir -p $out/bin; cd $out;
29− ${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' '${x}';\n") exes)}
37+ mkdir -p $out/bin;
38+ ${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' $out/bin/${x};\n") exes)}
3039 ${(lib.concatMapStrings (s: "makeWrapper $out/bin/$(basename ${s}) $srcdir/${s} " +
3140 "--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+
3241 "--set BUNDLE_PATH ${basicEnv}/${ruby.gemPath} "+