Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit 49094c8

Browse files
authored
Merge pull request #999 from dsalaza4/main
feat(back): #997 support sources
2 parents 1df869a + 3aeee18 commit 49094c8

4 files changed

Lines changed: 26 additions & 53 deletions

File tree

README.md

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3907,15 +3907,13 @@ Fetch a [Ruby][ruby] gem from [Ruby community’s gem hosting service][rubygems]
39073907
Types:
39083908
39093909
- fetchRubyGem (`function { ... } -> package`):
3910-
- name (`str`):
3911-
Name of the gem to download.
3912-
- version (`str`):
3913-
Version of the gem to download.
39143910
- sha256 (`str`):
39153911
SHA256 of the expected output,
39163912
In order to get the SHA256
39173913
you can omit this parameter and execute Makes,
39183914
Makes will tell you the correct SHA256 on failure.
3915+
- url (`str`):
3916+
url of the gem to download.
39193917
39203918
Example:
39213919
@@ -3925,9 +3923,8 @@ Example:
39253923
, ...
39263924
}:
39273925
fetchRubyGem {
3928-
name = "slim";
3929-
version = "4.1.0";
3930-
sha256 = "0gjx30g84c82qzg32bd7giscvb4206v7mvg56kc839w9wjagn36n";
3926+
sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y";
3927+
url = "https://rubygems.org/downloads/ast-2.4.2.gem";
39313928
}
39323929
```
39333930
@@ -4431,6 +4428,8 @@ $ m . /example
44314428
Fetch and install the specified [Ruby][ruby] gems
44324429
from the [Ruby community’s gem hosting service][rubygems].
44334430
4431+
Pre-requisites: [Generating a sourcesYaml](#makerubylock)
4432+
44344433
Types:
44354434
44364435
- makeRubyGemsInstall (`function { ... } -> package`):
@@ -4439,11 +4438,12 @@ Types:
44394438
Custom name to assign to the build step, be creative, it helps in debugging.
44404439
- ruby (`enum [ "2.7" "3.0" ]`):
44414440
Version of the [Ruby][ruby] interpreter.
4442-
- rubyGems (`listOf (asIn fetchRubyGem)`):
4443-
Ruby gems specification that should be fetched and installed.
44444441
- searchPaths (`asIn makeSearchPaths`): Optional.
44454442
Arguments here will be passed as-is to `makeSearchPaths`.
44464443
Defaults to `makeSearchPaths`'s defaults.
4444+
- sourcesYaml (`package`):
4445+
`sources.yaml` file
4446+
computed as explained in the pre-requisites section.
44474447
44484448
Example:
44494449
@@ -4455,23 +4455,7 @@ Example:
44554455
makeRubyGemsInstall {
44564456
name = "example";
44574457
ruby = "3.0";
4458-
rubyGems = [
4459-
{
4460-
name = "tilt";
4461-
version = "2.0.10";
4462-
sha256 = "0rn8z8hda4h41a64l0zhkiwz2vxw9b1nb70gl37h1dg2k874yrlv";
4463-
}
4464-
{
4465-
name = "slim";
4466-
version = "4.1.0";
4467-
sha256 = "0gjx30g84c82qzg32bd7giscvb4206v7mvg56kc839w9wjagn36n";
4468-
}
4469-
{
4470-
name = "temple";
4471-
version = "0.8.2";
4472-
sha256 = "060zzj7c2kicdfk6cpnn40n9yjnhfrr13d0rsbdhdij68chp2861";
4473-
}
4474-
];
4458+
sourcesYaml = projectPath "/makes/example/sources.yaml";
44754459
}
44764460
```
44774461
@@ -4481,6 +4465,8 @@ Create an environment where the specified [Ruby][ruby] gems
44814465
from the [Ruby community’s gem hosting service][rubygems]
44824466
are available.
44834467
4468+
Pre-requisites: [Generating a sourcesYaml](#makerubylock)
4469+
44844470
Types:
44854471
44864472
- makeRubyGemsEnvironment (`function { ... } -> package`):
@@ -4489,8 +4475,6 @@ Types:
44894475
Custom name to assign to the build step, be creative, it helps in debugging.
44904476
- ruby (`enum [ "2.7" "3.0" ]`):
44914477
Version of the [Ruby][ruby] interpreter.
4492-
- rubyGems (`listOf (asIn fetchRubyGem)`):
4493-
Ruby gems specification that should be fetched and installed.
44944478
- searchPathsBuild (`asIn makeSearchPaths`): Optional.
44954479
Arguments here will be passed as-is to `makeSearchPaths`
44964480
and used while installing gems.
@@ -4499,6 +4483,9 @@ Types:
44994483
Arguments here will be passed as-is to `makeSearchPaths`
45004484
and propagated to the runtime environment.
45014485
Defaults to `makeSearchPaths`'s defaults.
4486+
- sourcesYaml (`package`):
4487+
`sources.yaml` file
4488+
computed as explained in the pre-requisites section.
45024489
45034490
Example:
45044491
@@ -4513,25 +4500,9 @@ let
45134500
env = makeRubyGemsEnvironment {
45144501
name = "example";
45154502
ruby = "3.0";
4516-
rubyGems = [
4517-
{
4518-
name = "slim";
4519-
sha256 = "0gjx30g84c82qzg32bd7giscvb4206v7mvg56kc839w9wjagn36n";
4520-
version = "4.1.0";
4521-
}
4522-
{
4523-
name = "temple";
4524-
sha256 = "060zzj7c2kicdfk6cpnn40n9yjnhfrr13d0rsbdhdij68chp2861";
4525-
version = "0.8.2";
4526-
}
4527-
{
4528-
name = "tilt";
4529-
sha256 = "0rn8z8hda4h41a64l0zhkiwz2vxw9b1nb70gl37h1dg2k874yrlv";
4530-
version = "2.0.10";
4531-
}
4532-
];
45334503
searchPathsBuild.bin = [ inputs.nixpkgs.gcc ];
45344504
searchPathsRuntime.rpath = [ inputs.nixpkgs.gcc.cc.lib ];
4505+
sourcesYaml = projectPath "/makes/example/sources.yaml";
45354506
};
45364507
in
45374508
makeScript {

src/args/fetch-rubygem/default.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
fetchUrl,
44
...
55
}: {
6-
name,
76
sha256 ? fakeSha256,
8-
version,
7+
url,
8+
...
99
}:
1010
fetchUrl {
11-
url = "https://rubygems.org/downloads/${name}-${version}.gem";
1211
inherit sha256;
12+
inherit url;
1313
}

src/args/make-ruby-gems-environment/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
}: {
77
name,
88
ruby,
9-
rubyGems,
109
searchPathsBuild ? {},
1110
searchPathsRuntime ? {},
11+
sourcesYaml,
1212
}: let
1313
installation = makeRubyGemsInstall {
1414
inherit name;
1515
inherit ruby;
16-
inherit rubyGems;
1716
searchPaths = searchPathsBuild;
17+
inherit sourcesYaml;
1818
};
1919
in
2020
makeSearchPaths {

src/args/make-ruby-gems-install/default.nix

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
__nixpkgs__,
33
fetchRubyGem,
4+
fromYamlFile,
45
makeDerivation,
56
makeRubyVersion,
67
makeSearchPaths,
@@ -10,9 +11,10 @@
1011
}: {
1112
name,
1213
ruby,
13-
rubyGems,
1414
searchPaths ? {},
15+
sourcesYaml,
1516
}: let
17+
sources = fromYamlFile sourcesYaml;
1618
gems =
1719
builtins.map
1820
(
@@ -23,9 +25,9 @@
2325
path = gem;
2426
}
2527
)
26-
rubyGems;
28+
sources.links;
2729

28-
gemsSpec = builtins.map (gem: "${gem.name}:${gem.version}") rubyGems;
30+
gemsSpec = __nixpkgs__.lib.attrsets.mapAttrsToList (name: version: "${name}:${version}") sources.closure;
2931
in
3032
makeDerivation {
3133
builder = ./builder.sh;

0 commit comments

Comments
 (0)