Skip to content

Commit

Permalink
Merge branch 'main' into let-toml-import-toml
Browse files Browse the repository at this point in the history
  • Loading branch information
zimbatm authored Mar 16, 2023
2 parents ef97d3f + 7d2b7bc commit 3fc630d
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions extra/language/ruby.nix
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"; }
];
};
}

0 comments on commit 3fc630d

Please sign in to comment.