-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathruby.nix
More file actions
64 lines (63 loc) · 1.3 KB
/
ruby.nix
File metadata and controls
64 lines (63 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
lib,
config,
pkgs,
...
}:
let
cfg = config.language.ruby;
strOrPackage = import ../../nix/strOrPackage.nix { inherit lib pkgs; };
in
{
imports = [ ./c.nix ];
options.language.ruby = with lib; {
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
(lib.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";
}
];
};
}