-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into let-toml-import-toml
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 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,46 @@ | ||
{ lib, config, pkgs, ... }: | ||
let | ||
cfg = config.language.ruby; | ||
strOrPackage = import ../../nix/strOrPackage.nix { inherit lib pkgs; }; | ||
in | ||
with lib; | ||
{ | ||
imports = [ ./c.nix ]; | ||
options.language.ruby = { | ||
nativeDeps = mkOption { | ||
type = types.listOf strOrPackage; | ||
default = [ ]; | ||
description = "Use this when your gems depend on a dynamic library"; | ||
}; | ||
package = mkOption { | ||
type = strOrPackage; | ||
default = pkgs.ruby_3_2; | ||
defaultText = "pkgs.ruby_3_2"; | ||
description = "Ruby version used by your project"; | ||
}; | ||
}; | ||
|
||
config = { | ||
language.c = { | ||
compiler = pkgs.gcc; # Lots of gems don't compile properly with clang | ||
libraries = cfg.nativeDeps; | ||
includes = cfg.nativeDeps; | ||
}; | ||
devshell.packages = with pkgs; [ | ||
cfg.package | ||
# Used by mkmf, the standard gem build tool | ||
(lowPrio binutils) | ||
file | ||
findutils | ||
gnumake | ||
]; | ||
env = [ | ||
{ name = "CC"; value = "cc"; } | ||
{ name = "CPP"; value = "cpp"; } | ||
{ name = "CXX"; value = "c++"; } | ||
{ name = "GEM_HOME"; eval = "$PRJ_DATA_DIR/ruby/bundle/$(ruby -e 'puts RUBY_VERSION')"; } | ||
{ name = "PATH"; prefix = "$GEM_HOME/bin"; } | ||
]; | ||
}; | ||
} | ||
|