Loading pkgs/development/ruby-modules/bundled-common/default.nix +5 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ { name , pname ? name , mainGemName ? null , gemdir ? null , gemfile ? null , lockfile ? null Loading Loading @@ -44,13 +45,13 @@ let copyIfBundledByPath = { bundledByPath ? false, ...}@main: (if bundledByPath then assert gemFiles.gemdir != nil; "cp -a ${gemFiles.gemdir}/* $out/" assert gemFiles.gemdir != null; "cp -a ${gemFiles.gemdir}/* $out/" else "" ); maybeCopyAll = pname: if pname == null then "" else maybeCopyAll = pkgname: if pkgname == null then "" else let mainGem = gems."${pname}" or (throw "bundlerEnv: gem ${pname} not found"); mainGem = gems."${pkgname}" or (throw "bundlerEnv: gem ${pkgname} not found"); in copyIfBundledByPath mainGem; Loading @@ -59,7 +60,7 @@ let # out. Yes, I'm serious. confFiles = runCommand "gemfile-and-lockfile" {} '' mkdir -p $out ${maybeCopyAll pname} ${maybeCopyAll mainGemName} cp ${gemFiles.gemfile} $out/Gemfile || ls -l $out/Gemfile cp ${gemFiles.lockfile} $out/Gemfile.lock || ls -l $out/Gemfile.lock ''; Loading pkgs/development/ruby-modules/bundled-common/functions.nix +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ rec { , gemdir ? null , ... }: { inherit gemdir; gemfile = if gemfile == null then assert gemdir != null; gemdir + "/Gemfile" else gemfile; Loading pkgs/development/ruby-modules/bundler-env/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ let else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}" 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; # Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" - Loading pkgs/development/ruby-modules/tool/default.nix +11 −2 Original line number Diff line number Diff line { 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 ./. Loading @@ -25,8 +34,8 @@ let // { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults in runCommand name cmdArgs '' mkdir -p $out/bin; cd $out; ${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' '${x}';\n") exes)} 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} "+ Loading Loading
pkgs/development/ruby-modules/bundled-common/default.nix +5 −4 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ { name , pname ? name , mainGemName ? null , gemdir ? null , gemfile ? null , lockfile ? null Loading Loading @@ -44,13 +45,13 @@ let copyIfBundledByPath = { bundledByPath ? false, ...}@main: (if bundledByPath then assert gemFiles.gemdir != nil; "cp -a ${gemFiles.gemdir}/* $out/" assert gemFiles.gemdir != null; "cp -a ${gemFiles.gemdir}/* $out/" else "" ); maybeCopyAll = pname: if pname == null then "" else maybeCopyAll = pkgname: if pkgname == null then "" else let mainGem = gems."${pname}" or (throw "bundlerEnv: gem ${pname} not found"); mainGem = gems."${pkgname}" or (throw "bundlerEnv: gem ${pkgname} not found"); in copyIfBundledByPath mainGem; Loading @@ -59,7 +60,7 @@ let # out. Yes, I'm serious. confFiles = runCommand "gemfile-and-lockfile" {} '' mkdir -p $out ${maybeCopyAll pname} ${maybeCopyAll mainGemName} cp ${gemFiles.gemfile} $out/Gemfile || ls -l $out/Gemfile cp ${gemFiles.lockfile} $out/Gemfile.lock || ls -l $out/Gemfile.lock ''; Loading
pkgs/development/ruby-modules/bundled-common/functions.nix +2 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ rec { , gemdir ? null , ... }: { inherit gemdir; gemfile = if gemfile == null then assert gemdir != null; gemdir + "/Gemfile" else gemfile; Loading
pkgs/development/ruby-modules/bundler-env/default.nix +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ let else if pname != null then "${toString pname}-${basicEnv.gems."${pname}".version}" 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; # Idea here is a mkDerivation that gen-bin-stubs new stubs "as specified" - Loading
pkgs/development/ruby-modules/tool/default.nix +11 −2 Original line number Diff line number Diff line { 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 ./. Loading @@ -25,8 +34,8 @@ let // { inherit preferLocalBuild allowSubstitutes; }; # pass the defaults in runCommand name cmdArgs '' mkdir -p $out/bin; cd $out; ${(lib.concatMapStrings (x: "ln -s '${basicEnv}/bin/${x}' '${x}';\n") exes)} 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} "+ Loading