-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is entirely optional to use but for nixpkgs users this is a really easy way to get things up and running. With just: ``` nix-shell ``` All needed dependencies get automatically pulled in, dropping the user in a ready-to-use shell. Then as usual: ``` bundle install ``` Puts everything in a `vendor/bundle` directory, which behaves as usual regarding `gem install` and `bundle` in general. Should it need to be cleaned up, e.g to start form scratch, a simple `rm -rf vendor/bundle` is sufficient. Also, gem commands can typically be run with or without `bundle exec`. It also pins to a specific commit for the channel, so that tool versions are always consistent across platforms (incl. CPU arches and OSes).
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
*.gem | ||
*.rbc | ||
*.swp | ||
*.nix | ||
*.vim | ||
/.config | ||
/coverage/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
# use the environment channel | ||
pkgs ? import <nixpkgs> {}, | ||
|
||
# use a pinned package state | ||
pinned ? import(fetchTarball("https://github.com/NixOS/nixpkgs/archive/14d9b465c71.tar.gz")) {}, | ||
}: | ||
let | ||
# specify ruby version to use | ||
ruby = pinned.ruby_3_1; | ||
|
||
# control llvm/clang version (e.g for packages built from source) | ||
llvm = pinned.llvmPackages_12; | ||
|
||
# control gcc version (e.g for packages built from source) | ||
gcc = pinned.gcc12; | ||
in llvm.stdenv.mkDerivation { | ||
# unique project name for this environment derivation | ||
name = "dd-trace-rb.devshell"; | ||
|
||
buildInputs = [ | ||
ruby | ||
|
||
# TODO: some gems insist on using `gcc` on Linux, satisfy them for now: | ||
# - json | ||
# - protobuf | ||
# - ruby-prof | ||
gcc | ||
]; | ||
|
||
shellHook = '' | ||
# get major.minor.0 ruby version | ||
export RUBY_VERSION="$(ruby -e 'puts RUBY_VERSION.gsub(/\d+$/, "0")')" | ||
# make gem install work in-project, compatibly with bundler | ||
export GEM_HOME="$(pwd)/vendor/bundle/ruby/$RUBY_VERSION" | ||
# make bundle work in-project | ||
export BUNDLE_PATH="$(pwd)/vendor/bundle" | ||
# enable calling gem scripts without bundle exec | ||
export PATH="$GEM_HOME/bin:$PATH" | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
|Steepfile | ||
|ddtrace\.gemspec | ||
|docker-compose\.yml | ||
|shell\.nix | ||
) | ||
$ | ||
/x | ||
|