You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a drop-in replacement for `cargo` which yet uses crates.io index.
2
+
A drop-in replacement for `cargo` which yet uses crates.io index.
3
3
4
-
**note:** this is an early draft don't expect much.
4
+
**Warning**: crates.io-index uses 'semantic versioning' (see http://semver.org/) and we don't support this here. 'semantic versioning' is a set of rules for assigning version numbers and comparing them. Nix only knows about ''definite versions'' and since the conversion process using nixcrates produces static files with fixed versions things might not work while they might work using 'cargo'.
5
+
Having only ''definite versions'' implies no dependency calculation, for instance by using SAT to solve them, has prooven to be a great relief in many situations. However, it would require a **cargo2nix** tool to have that.
5
6
6
-
**warning**: crates.io-index uses 'semantic versioning' (see http://semver.org/) and we don't support this here. 'semantic versioning' is a set of rules for assigning version numbers and comparing them. Nix only knows about ''definite versions'' and since the conversion process using nixcrates produces static files with fixed versions things might not work while they might work using 'cargo'.
7
-
having only ''definite versions'' implies no dependency calculation, for instance by using SAT to solve them, has prooven to be a great relief in many situations. however, it would require a **cargo2nix** tool to have that.
7
+
**Warning**: This repo has 42mib+ because it still contains a checkin of the nixified nix-crate-index which later was layed of into its own repository on `https://github.com/nixcloud/nix-crates-index.git`. Someone has to do a 'git rebase' and remove it...
8
8
9
-
# usage
9
+
# Usage
10
10
11
-
creating a initial crates.io-index conversion:
11
+
We describe an initial procedure to keep old revisions around.
12
+
13
+
## Iterative update
14
+
15
+
If you are using our index from `https://github.com/nixcloud/nix-crates-index.git` then you need to do this:
16
+
17
+
1. update the crates.io-index repository:
18
+
19
+
cd crates.io-index
20
+
git pull
21
+
22
+
2. use `nixcrates` to update it
23
+
24
+
cd nix-crates-index/
25
+
# remove all files (nixcrates would not do that for us!)
26
+
rm -Rf *
27
+
nixcrates ../crates.io-index/ ./
28
+
git add *
29
+
30
+
git rev-parse master
31
+
fc336466a7ede6f14ce427deb5a64c5d02d14be0
32
+
33
+
git commit -m 'fc3364: new revision added'
34
+
35
+
3. afterwards try to build your packages and eventually update `nix-crates-index/all-carg-packages.nix` to reflect dependency changes
this will then create a 1:1 directory structure and nixify all crates.io JSON files.
50
+
This will then create a 1:1 directory structure and nixify all crates.io JSON files.
51
+
52
+
**Warning**: Normally this should not be done since you want iterative updates.
21
53
22
-
warning: this repo contains a modified version of a converted crates.io-index
54
+
**Warning**: This way we need to bootstrap `nixcrate` with `cargo` and rustStable from `NixOS`/`nixpkgs`.
23
55
24
-
# build examples
56
+
# Build examples
25
57
26
-
you need rustc nightly from most recent nipxkgs master!
58
+
Currently we use `rustc nightly` from most recent `nipxkgs master`!
27
59
28
-
example targets:
60
+
Example targets:
29
61
30
62
nix-build default.nix -A nixcrates
31
63
nix-build default.nix -A allTargets
64
+
nix-build default.nix -A allCrates.rustache
32
65
33
-
warning: there are horrible hack in this project just to make this minimal set of packages work. we were under a lot of time-pressure and low in funding. on judgement day, hopefully god didn't see it!
34
-
35
-
# todos
36
-
37
-
* write better documentation
38
-
66
+
**Warning**: there are horrible hack in this project just to make this minimal set of packages work. we were under a lot of time-pressure and low in funding. on judgement day, hopefully god didn't see it!
39
67
40
-
# how it works
68
+
# How it works
41
69
We are parsing the json files of the crates.io repository and translating them into nix files. Considering dependencies we are currently only supporting versening via `~` and `^` as well as single versions. If anything else is used we are switching to the newest version. In case of `^` and `~` we are using the highest allowed version.
42
70
43
-
## how do versions look like in the created
71
+
## How do versions look like in the created
44
72
`{package_name}` is pointing on the newest version.
45
73
`all__{package_name}` contains a set of all versions.
46
74
47
75
There are also several shortcuts to address the newest subversion. For every missing semver version number simply the newest is assumed.
48
76
For example `all__{package_name}.{package_name}_0_1` points the the version of `{package_name}` with `0.1.X` where `X` is the highest number found.
49
77
50
-
## what failes and why?
78
+
## What failes and why?
51
79
52
80
### Missing dependencies
53
81
For some reason sometimes the crates.io json file is not listing all the dependencies. If this occours the missing dependencie has to be added by hand. However eddeting an autogenerated file is a pain.
@@ -65,3 +93,12 @@ Lets assume:
65
93
66
94
Now our repo would compile `dep_a` with `dep_c_0_2_0` and `dep_b` with `dep_c_0_1_2`. This is a problem as soon as `{dep_a}` as well as `{dep_b}` are exposing types from `{dep_c}` in their interfaces.
67
95
96
+
### Not supported stuff
97
+
98
+
The `flate2-example` uses `miniz-sys` which uses `bundled c code` that is something we don't support yet. To see the error:
99
+
100
+
nix-build -I nixpkgs=/home/joachim/Desktop/projects/nixos/nixpkgs -A allCrates.miniz-sys
101
+
102
+
### Dependencies
103
+
104
+
Say a crate you want does not build since a dependency is not set correctly, then you can use `lib.recursiveUpdate` in `nix-crates-index/all-carg-packages.nix` to change/extend them. This holds also true for `pkgs` from nixpkgs!
0 commit comments