1
1
2
- # This file was @generated by crate2nix 0.9 .0 with the command:
2
+ # This file was @generated by crate2nix 0.10 .0 with the command:
3
3
# "generate"
4
4
# See https://github.com/kolloch/crate2nix for more info.
5
5
8
8
, lib ? pkgs . lib
9
9
, stdenv ? pkgs . stdenv
10
10
, buildRustCrateForPkgs ? if buildRustCrate != null
11
- then lib . warn "`buildRustCrate` is deprecated, use `buildRustCrateForPkgs` instead" ( _ : buildRustCrate )
11
+ then lib . warn "crate2nix: Passing `buildRustCrate` as argument to Cargo.nix is deprecated. If you don't customize `buildRustCrate`, replace `callPackage ./Cargo.nix {}` by `import ./Cargo.nix { inherit pkgs; }`, and if you need to customize `buildRustCrate`, use `buildRustCrateForPkgs` instead. " ( _ : buildRustCrate )
12
12
else pkgs : pkgs . buildRustCrate
13
13
# Deprecated
14
14
, buildRustCrate ? null
@@ -3014,7 +3014,7 @@ rec {
3014
3014
} ;
3015
3015
"libpijul" = rec {
3016
3016
crateName = "libpijul" ;
3017
- version = "1.0.0-alpha.47 " ;
3017
+ version = "1.0.0-alpha.48 " ;
3018
3018
edition = "2018" ;
3019
3019
src = lib . cleanSourceWith { filter = sourceFilter ; src = ./libpijul ; } ;
3020
3020
authors = [
@@ -4395,6 +4395,10 @@ rec {
4395
4395
name = "terminal_size" ;
4396
4396
packageId = "terminal_size" ;
4397
4397
}
4398
+ {
4399
+ name = "thiserror" ;
4400
+ packageId = "thiserror" ;
4401
+ }
4398
4402
{
4399
4403
name = "thrussh" ;
4400
4404
packageId = "thrussh" ;
@@ -6023,24 +6027,6 @@ rec {
6023
6027
}
6024
6028
] ;
6025
6029
6026
- } ;
6027
- "threadpool" = rec {
6028
- crateName = "threadpool" ;
6029
- version = "1.8.1" ;
6030
- edition = "2015" ;
6031
- sha256 = "1amgfyzvynbm8pacniivzq9r0fh3chhs7kijic81j76l6c5ycl6h" ;
6032
- authors = [
6033
- "The Rust Project Developers"
6034
- "Corey Farwell <coreyf@rwell.org>"
6035
- "Stefan Schindler <dns2utf8@estada.ch>"
6036
- ] ;
6037
- dependencies = [
6038
- {
6039
- name = "num_cpus" ;
6040
- packageId = "num_cpus" ;
6041
- }
6042
- ] ;
6043
-
6044
6030
} ;
6045
6031
"thrussh" = rec {
6046
6032
crateName = "thrussh" ;
@@ -7811,6 +7797,18 @@ rec {
7811
7797
} ;
7812
7798
resolvedDefaultFeatures = [ "default" "unsupported" ] ;
7813
7799
} ;
7800
+ "xxhash-rust" = rec {
7801
+ crateName = "xxhash-rust" ;
7802
+ version = "0.8.2" ;
7803
+ edition = "2018" ;
7804
+ sha256 = "1v9dk6shls1rsmidf2dxdi3460bn7ingqgvn5mf7prgnxmdy2xg5" ;
7805
+ authors = [
7806
+ "Douman <douman@gmx.se>"
7807
+ ] ;
7808
+ features = {
7809
+ } ;
7810
+ resolvedDefaultFeatures = [ "xxh64" ] ;
7811
+ } ;
7814
7812
"yasna" = rec {
7815
7813
crateName = "yasna" ;
7816
7814
version = "0.4.0" ;
@@ -7888,11 +7886,12 @@ rec {
7888
7886
} ;
7889
7887
"zstd-seekable" = rec {
7890
7888
crateName = "zstd-seekable" ;
7891
- version = "0.1.7 " ;
7889
+ version = "0.2.1 " ;
7892
7890
edition = "2018" ;
7893
- sha256 = "0bxzd71myj094hp03jpqbv1r80x0hk1ahsjwfv50j0wgx379jfry " ;
7891
+ sha256 = "16ag26g74k296ppi0flz47qvrfi938km95jvr0brphpcwc2wqqdc " ;
7894
7892
authors = [
7895
7893
"Pierre-Étienne Meunier <pe@pijul.org>"
7894
+ "Darley Barreto <darleybarreto@gmail.com>"
7896
7895
] ;
7897
7896
dependencies = [
7898
7897
{
@@ -7904,15 +7903,12 @@ rec {
7904
7903
packageId = "thiserror" ;
7905
7904
}
7906
7905
{
7907
- name = "threadpool" ;
7908
- packageId = "threadpool" ;
7906
+ name = "xxhash-rust" ;
7907
+ packageId = "xxhash-rust" ;
7908
+ features = [ "xxh64" ] ;
7909
7909
}
7910
7910
] ;
7911
7911
buildDependencies = [
7912
- {
7913
- name = "cc" ;
7914
- packageId = "cc" ;
7915
- }
7916
7912
{
7917
7913
name = "pkg-config" ;
7918
7914
packageId = "pkg-config" ;
@@ -7927,7 +7923,7 @@ rec {
7927
7923
#
7928
7924
7929
7925
/* Target (platform) data for conditional dependencies.
7930
- This corresponds roughly to what buildRustCrate is setting.
7926
+ This corresponds roughly to what buildRustCrate is setting.
7931
7927
*/
7932
7928
defaultTarget = {
7933
7929
unix = true ;
@@ -7999,14 +7995,16 @@ rec {
7999
7995
) ;
8000
7996
8001
7997
/* Returns a crate which depends on successful test execution
8002
- of crate given as the second argument.
7998
+ of crate given as the second argument.
8003
7999
8004
- testCrateFlags: list of flags to pass to the test exectuable
8005
- testInputs: list of packages that should be available during test execution
8000
+ testCrateFlags: list of flags to pass to the test exectuable
8001
+ testInputs: list of packages that should be available during test execution
8006
8002
*/
8007
- crateWithTest = { crate , testCrate , testCrateFlags , testInputs } :
8003
+ crateWithTest = { crate , testCrate , testCrateFlags , testInputs , testPreRun , testPostRun } :
8008
8004
assert builtins . typeOf testCrateFlags == "list" ;
8009
8005
assert builtins . typeOf testInputs == "list" ;
8006
+ assert builtins . typeOf testPreRun == "string" ;
8007
+ assert builtins . typeOf testPostRun == "string" ;
8010
8008
let
8011
8009
# override the `crate` so that it will build and execute tests instead of
8012
8010
# building the actual lib and bin targets We just have to pass `--test`
@@ -8020,6 +8018,15 @@ rec {
8020
8018
buildTests = true ;
8021
8019
}
8022
8020
) ;
8021
+ # If the user hasn't set any pre/post commands, we don't want to
8022
+ # insert empty lines. This means that any existing users of crate2nix
8023
+ # don't get a spurious rebuild unless they set these explicitly.
8024
+ testCommand = pkgs . lib . concatStringsSep "\n "
8025
+ ( pkgs . lib . filter ( s : s != "" ) [
8026
+ testPreRun
8027
+ "$f $testCrateFlags 2>&1 | tee -a $out"
8028
+ testPostRun
8029
+ ] ) ;
8023
8030
in
8024
8031
pkgs . runCommand "run-tests-${ testCrate . name } "
8025
8032
{
@@ -8053,7 +8060,7 @@ rec {
8053
8060
for file in ${ drv } /tests/*; do
8054
8061
f=$testRoot/$(basename $file)-$hash
8055
8062
cp $file $f
8056
- $f $testCrateFlags 2>&1 | tee -a $out
8063
+ ${ testCommand }
8057
8064
done
8058
8065
'' ;
8059
8066
in
@@ -8077,6 +8084,10 @@ rec {
8077
8084
, runTests ? false
8078
8085
, testCrateFlags ? [ ]
8079
8086
, testInputs ? [ ]
8087
+ # Any command to run immediatelly before a test is executed.
8088
+ , testPreRun ? ""
8089
+ # Any command run immediatelly after a test is executed.
8090
+ , testPostRun ? ""
8080
8091
} :
8081
8092
lib . makeOverridable
8082
8093
(
@@ -8085,6 +8096,8 @@ rec {
8085
8096
, runTests
8086
8097
, testCrateFlags
8087
8098
, testInputs
8099
+ , testPreRun
8100
+ , testPostRun
8088
8101
} :
8089
8102
let
8090
8103
buildRustCrateForPkgsFuncOverriden =
@@ -8117,16 +8130,16 @@ rec {
8117
8130
{
8118
8131
crate = drv ;
8119
8132
testCrate = testDrv ;
8120
- inherit testCrateFlags testInputs ;
8133
+ inherit testCrateFlags testInputs testPreRun testPostRun ;
8121
8134
}
8122
8135
else drv ;
8123
8136
in
8124
8137
derivation
8125
8138
)
8126
- { inherit features crateOverrides runTests testCrateFlags testInputs ; } ;
8139
+ { inherit features crateOverrides runTests testCrateFlags testInputs testPreRun testPostRun ; } ;
8127
8140
8128
8141
/* Returns an attr set with packageId mapped to the result of buildRustCrateForPkgsFunc
8129
- for the corresponding crate.
8142
+ for the corresponding crate.
8130
8143
*/
8131
8144
builtRustCratesWithFeatures =
8132
8145
{ packageId
@@ -8264,7 +8277,7 @@ rec {
8264
8277
map depDerivation enabledDependencies ;
8265
8278
8266
8279
/* Returns a sanitized version of val with all values substituted that cannot
8267
- be serialized as JSON.
8280
+ be serialized as JSON.
8268
8281
*/
8269
8282
sanitizeForJson = val :
8270
8283
if builtins . isAttrs val
@@ -8309,9 +8322,9 @@ rec {
8309
8322
{ internal = debug ; } ;
8310
8323
8311
8324
/* Returns differences between cargo default features and crate2nix default
8312
- features.
8325
+ features.
8313
8326
8314
- This is useful for verifying the feature resolution in crate2nix.
8327
+ This is useful for verifying the feature resolution in crate2nix.
8315
8328
*/
8316
8329
diffDefaultPackageFeatures =
8317
8330
{ crateConfigs ? crates
@@ -8348,8 +8361,8 @@ rec {
8348
8361
8349
8362
/* Returns an attrset mapping packageId to the list of enabled features.
8350
8363
8351
- If multiple paths to a dependency enable different features, the
8352
- corresponding feature sets are merged. Features in rust are additive.
8364
+ If multiple paths to a dependency enable different features, the
8365
+ corresponding feature sets are merged. Features in rust are additive.
8353
8366
*/
8354
8367
mergePackageFeatures =
8355
8368
{ crateConfigs ? crates
@@ -8374,10 +8387,11 @@ rec {
8374
8387
let
8375
8388
crateConfig = crateConfigs . "${ packageId } " or ( builtins . throw "Package not found: ${ packageId } " ) ;
8376
8389
expandedFeatures = expandFeatures ( crateConfig . features or { } ) features ;
8390
+ enabledFeatures = enableFeatures ( crateConfig . dependencies or [ ] ) expandedFeatures ;
8377
8391
depWithResolvedFeatures = dependency :
8378
8392
let
8379
8393
packageId = dependency . packageId ;
8380
- features = dependencyFeatures expandedFeatures dependency ;
8394
+ features = dependencyFeatures enabledFeatures dependency ;
8381
8395
in
8382
8396
{ inherit packageId features ; } ;
8383
8397
resolveDependencies = cache : path : dependencies :
@@ -8386,7 +8400,7 @@ rec {
8386
8400
let
8387
8401
enabledDependencies = filterEnabledDependencies {
8388
8402
inherit dependencies target ;
8389
- features = expandedFeatures ;
8403
+ features = enabledFeatures ;
8390
8404
} ;
8391
8405
directDependencies = map depWithResolvedFeatures enabledDependencies ;
8392
8406
foldOverCache = op : lib . foldl op cache directDependencies ;
@@ -8410,7 +8424,7 @@ rec {
8410
8424
cacheWithSelf =
8411
8425
let
8412
8426
cacheFeatures = featuresByPackageId . ${ packageId } or [ ] ;
8413
- combinedFeatures = sortedUnique ( cacheFeatures ++ expandedFeatures ) ;
8427
+ combinedFeatures = sortedUnique ( cacheFeatures ++ enabledFeatures ) ;
8414
8428
in
8415
8429
featuresByPackageId // {
8416
8430
"${ packageId } " = combinedFeatures ;
@@ -8462,10 +8476,10 @@ rec {
8462
8476
|| startsWithPrefix ;
8463
8477
8464
8478
/* Returns the expanded features for the given inputFeatures by applying the
8465
- rules in featureMap.
8479
+ rules in featureMap.
8466
8480
8467
- featureMap is an attribute set which maps feature names to lists of further
8468
- feature names to enable in case this feature is selected.
8481
+ featureMap is an attribute set which maps feature names to lists of further
8482
+ feature names to enable in case this feature is selected.
8469
8483
*/
8470
8484
expandFeatures = featureMap : inputFeatures :
8471
8485
assert ( builtins . isAttrs featureMap ) ;
@@ -8478,10 +8492,32 @@ rec {
8478
8492
in
8479
8493
sortedUnique outFeatures ;
8480
8494
8495
+ /* This function adds optional dependencies as features if they are enabled
8496
+ indirectly by dependency features. This function mimics Cargo's behavior
8497
+ described in a note at:
8498
+ https://doc.rust-lang.org/nightly/cargo/reference/features.html#dependency-features
8499
+ */
8500
+ enableFeatures = dependencies : features :
8501
+ assert ( builtins . isList features ) ;
8502
+ assert ( builtins . isList dependencies ) ;
8503
+ let
8504
+ additionalFeatures = lib . concatMap
8505
+ (
8506
+ dependency :
8507
+ assert ( builtins . isAttrs dependency ) ;
8508
+ let
8509
+ enabled = builtins . any ( doesFeatureEnableDependency dependency ) features ;
8510
+ in
8511
+ if ( dependency . optional or false ) && enabled then [ dependency . name ] else [ ]
8512
+ )
8513
+ dependencies ;
8514
+ in
8515
+ sortedUnique ( features ++ additionalFeatures ) ;
8516
+
8481
8517
/*
8482
- Returns the actual features for the given dependency.
8518
+ Returns the actual features for the given dependency.
8483
8519
8484
- features: The features of the crate that refers this dependency.
8520
+ features: The features of the crate that refers this dependency.
8485
8521
*/
8486
8522
dependencyFeatures = features : dependency :
8487
8523
assert ( builtins . isList features ) ;
@@ -8520,6 +8556,6 @@ rec {
8520
8556
#
8521
8557
# crate2nix/default.nix (excerpt end)
8522
8558
#
8523
-
8524
8559
} ;
8525
- }
8560
+ }
8561
+
0 commit comments