diff options
author | Judson <nyarly@gmail.com> | 2017-06-27 10:56:36 -0700 |
---|---|---|
committer | Judson <nyarly@gmail.com> | 2017-06-27 10:56:36 -0700 |
commit | 70e7e543c5493761cf065dc96ec8c8cbafe40aba (patch) | |
tree | 41980a5b1a0eb801ee889baf9cf4d0ab41e2a530 /pkgs/development/ruby-modules/bundler-app | |
parent | 603e84caefe2be319263ad6f83637af533834cc9 (diff) | |
download | nixpkgs-70e7e543c5493761cf065dc96ec8c8cbafe40aba.tar nixpkgs-70e7e543c5493761cf065dc96ec8c8cbafe40aba.tar.gz nixpkgs-70e7e543c5493761cf065dc96ec8c8cbafe40aba.tar.bz2 nixpkgs-70e7e543c5493761cf065dc96ec8c8cbafe40aba.tar.lz nixpkgs-70e7e543c5493761cf065dc96ec8c8cbafe40aba.tar.xz nixpkgs-70e7e543c5493761cf065dc96ec8c8cbafe40aba.tar.zst nixpkgs-70e7e543c5493761cf065dc96ec8c8cbafe40aba.zip |
A few cleanups and renames. One feature remains...
Diffstat (limited to 'pkgs/development/ruby-modules/bundler-app')
-rw-r--r-- | pkgs/development/ruby-modules/bundler-app/default.nix | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/development/ruby-modules/bundler-app/default.nix b/pkgs/development/ruby-modules/bundler-app/default.nix new file mode 100644 index 00000000000..a5308b79ff3 --- /dev/null +++ b/pkgs/development/ruby-modules/bundler-app/default.nix @@ -0,0 +1,47 @@ +{ 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 + # gemdir is the location of the Gemfile{,.lock} and gemset.nix; usually ./. +, gemdir + # Exes is the list of executables provided by the gems in the Gemfile +, exes ? [] + # Scripts are ruby programs depend on gems in the Gemfile (e.g. scripts/rails) +, scripts ? [] +, ruby ? defs.ruby +, gemfile ? null +, lockfile ? null +, gemset ? null +, preferLocalBuild ? false +, allowSubstitutes ? false +, meta ? {} +, postBuild ? "" +}@args: + +let + basicEnv = (callPackage ../bundled-common {}) args; + + cmdArgs = removeAttrs args [ "name" "postBuild" ] + // { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults +in + runCommand name cmdArgs '' + mkdir -p $out/bin; + ${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' $out/bin/${x};\n") exes)} + ${(lib.concatMapStrings (s: "makeWrapper $out/bin/$(basename ${s}) $srcdir/${s} " + + "--set BUNDLE_GEMFILE ${basicEnv.confFiles}/Gemfile "+ + "--set BUNDLE_PATH ${basicEnv}/${ruby.gemPath} "+ + "--set BUNDLE_FROZEN 1 "+ + "--set GEM_HOME ${basicEnv}/${ruby.gemPath} "+ + "--set GEM_PATH ${basicEnv}/${ruby.gemPath} "+ + "--run \"cd $srcdir\";\n") scripts)} + ${postBuild} + '' |