Packaging/Ruby: Difference between revisions

imported>Makefu
fix typo
F0x (talk | contribs)
Add example for setting gemConfig for bundlerEnv, extending from defaultGemConfig.
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
See [https://nixos.org/manual/nixpkgs/stable/#packaging-applications Packaging Ruby programs] in the nixpkgs manual
Ruby projects are generally packaged with [https://github.com/manveru/bundix bundix]. This guide will show how to package a ruby project
Ruby projects are generally packaged with [https://github.com/manveru/bundix bundix]. This guide will show how to package a ruby project
See


== Building '''BeEF''' ==
== Building '''BeEF''' ==
Line 30: Line 36:
<syntaxHighlight lang=console>
<syntaxHighlight lang=console>
$ nix-shell
$ nix-shell
$ bundle install     # generates Gemfile.lock
$ bundle lock     # generates Gemfile.lock
$ bundix              # generates gemset.nix
$ bundix              # generates gemset.nix
</syntaxHighlight>
</syntaxHighlight>
Line 86: Line 92:
}
}
</syntaxHighlight>
</syntaxHighlight>
=== Override gemConfig locally ===
<syntaxhighlight lang="nix">
gems = bundlerEnv {
    name = "beef-env";
    inherit ruby;
    gemdir  = ./.;
    gemConfig = pkgs.defaultGemConfig // {
        do_sqlite3 = attrs: {
            buildInputs = [ sqlite ];
        };
    };
};
</syntaxhighlight>




Line 109: Line 128:
   };
   };
</syntaxHighlight>
</syntaxHighlight>
=== set the local gemConfig ===
'''TODO''': also merge with the <code>defaultGemConfig</code> somehow


== Using Bundler 2 ==
== Using Bundler 2 ==


Bundler 2 comes included with Ruby, so instead of importing <code>ruby.devEnv</code> import Ruby and Bundix separately.
Bundler 2 comes included with Ruby, so instead of importing <code>ruby.devEnv</code> import Ruby and Bundix separately.
[[Category:Development]]
[[Category:Ruby]]