-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
155 additions
and
47 deletions.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# flake-compat shim for usage without flakes | ||
(import | ||
( | ||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in | ||
fetchTarball { | ||
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).defaultNix |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,57 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/master"; | ||
|
||
# cross-platform convenience | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
# backwards compatibility with nix-build and nix-shell | ||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, flake-compat }: | ||
# resolve for all platforms in turn | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
# packages for this system platform | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
|
||
# control versions | ||
ruby = pkgs.ruby_3_3; | ||
llvm = pkgs.llvmPackages_18; | ||
gcc = pkgs.gcc14; | ||
in { | ||
devShell = pkgs.llvm.stdenv.mkDerivation { | ||
name = "devshell"; | ||
|
||
buildInputs = with pkgs; [ | ||
ruby | ||
libyaml.dev | ||
|
||
# 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" | ||
# enable implicitly resolving gems to bundled version | ||
export RUBYGEMS_GEMDEPS="$(pwd)/Gemfile" | ||
''; | ||
}; | ||
} | ||
); | ||
} |
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,47 +1,11 @@ | ||
{ | ||
# use the environment channel | ||
pkgs ? import <nixpkgs> {}, | ||
|
||
# use a pinned package state | ||
pinned ? import(fetchTarball("https://github.com/NixOS/nixpkgs/archive/b87dfeec0dd1.tar.gz")) {}, | ||
}: | ||
let | ||
# specify ruby version to use | ||
ruby = pinned.ruby_3_3; | ||
|
||
# control llvm/clang version (e.g for packages built from source) | ||
llvm = pinned.llvmPackages_18; | ||
|
||
# control gcc version (e.g for packages built from source) | ||
gcc = pinned.gcc14; | ||
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" | ||
# enable `bundle exec`-less commands | ||
export RUBYGEMS_GEMDEPS="$(pwd)/Gemfile | ||
''; | ||
} | ||
# flake-compat shim for usage without flakes | ||
(import | ||
( | ||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in | ||
fetchTarball { | ||
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).shellNix |