Skip to content

Commit

Permalink
Auto detect workspace_member for git sources.
Browse files Browse the repository at this point in the history
Cargo does this for git repositories as well:

rust-lang/cargo#1462 (comment)

This will fix #33, #53 -- integration tests pending.

It depends on a nixpkgs buildRustCrate feature PR:

NixOS/nixpkgs#82155
  • Loading branch information
kolloch committed Mar 12, 2020
1 parent f2d16ac commit 2170298
Show file tree
Hide file tree
Showing 8 changed files with 708 additions and 0 deletions.
1 change: 1 addition & 0 deletions crate2nix/templates/build.nix.tera
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ rec {
{%- elif crate.source.LocalDirectory.path %}
src = (builtins.filterSource sourceFilter {{crate.source.LocalDirectory.path | safe}});
{%- elif crate.source.Git %}
workspace_member = null;
src = pkgs.fetchgit {
url = {{crate.source.Git.url}};
rev = {{crate.source.Git.rev}};
Expand Down
1 change: 1 addition & 0 deletions sample_projects/bin_with_git_branch_dep/Cargo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ rec {
crateName = "nix-base32";
version = "0.1.2-alpha.0";
edition = "2018";
workspace_member = null;
src = pkgs.fetchgit {
url = "https://github.com/kolloch/nix-base32";
rev = "42f5544e51187f0c7535d453fcffb4b524c99eb2";
Expand Down
2 changes: 2 additions & 0 deletions sample_projects/bin_with_git_submodule_dep/Cargo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ rec {
crateName = "librocksdb-sys";
version = "6.2.4";
edition = "2015";
workspace_member = null;
src = pkgs.fetchgit {
url = "https://github.com/rust-rocksdb/rust-rocksdb";
rev = "64bd09899306d23dfd1504465bd1e9adb15fb9ca";
Expand Down Expand Up @@ -982,6 +983,7 @@ rec {
crateName = "rocksdb";
version = "0.13.0";
edition = "2015";
workspace_member = null;
src = pkgs.fetchgit {
url = "https://github.com/rust-rocksdb/rust-rocksdb";
rev = "64bd09899306d23dfd1504465bd1e9adb15fb9ca";
Expand Down
19 changes: 19 additions & 0 deletions sample_projects/sub_dir_crates/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2170298

Please sign in to comment.