Skip to content

Commit cf9057d

Browse files
author
fossdd
committed
Update pijul
1 parent 8889a01 commit cf9057d

File tree

23 files changed

+415
-194
lines changed

23 files changed

+415
-194
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 89 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

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:
33
# "generate"
44
# See https://github.com/kolloch/crate2nix for more info.
55

@@ -8,7 +8,7 @@
88
, lib ? pkgs.lib
99
, stdenv ? pkgs.stdenv
1010
, 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)
1212
else pkgs: pkgs.buildRustCrate
1313
# Deprecated
1414
, buildRustCrate ? null
@@ -3014,7 +3014,7 @@ rec {
30143014
};
30153015
"libpijul" = rec {
30163016
crateName = "libpijul";
3017-
version = "1.0.0-alpha.47";
3017+
version = "1.0.0-alpha.48";
30183018
edition = "2018";
30193019
src = lib.cleanSourceWith { filter = sourceFilter; src = ./libpijul; };
30203020
authors = [
@@ -4395,6 +4395,10 @@ rec {
43954395
name = "terminal_size";
43964396
packageId = "terminal_size";
43974397
}
4398+
{
4399+
name = "thiserror";
4400+
packageId = "thiserror";
4401+
}
43984402
{
43994403
name = "thrussh";
44004404
packageId = "thrussh";
@@ -6023,24 +6027,6 @@ rec {
60236027
}
60246028
];
60256029

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-
60446030
};
60456031
"thrussh" = rec {
60466032
crateName = "thrussh";
@@ -7811,6 +7797,18 @@ rec {
78117797
};
78127798
resolvedDefaultFeatures = [ "default" "unsupported" ];
78137799
};
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+
};
78147812
"yasna" = rec {
78157813
crateName = "yasna";
78167814
version = "0.4.0";
@@ -7888,11 +7886,12 @@ rec {
78887886
};
78897887
"zstd-seekable" = rec {
78907888
crateName = "zstd-seekable";
7891-
version = "0.1.7";
7889+
version = "0.2.1";
78927890
edition = "2018";
7893-
sha256 = "0bxzd71myj094hp03jpqbv1r80x0hk1ahsjwfv50j0wgx379jfry";
7891+
sha256 = "16ag26g74k296ppi0flz47qvrfi938km95jvr0brphpcwc2wqqdc";
78947892
authors = [
78957893
"Pierre-Étienne Meunier <pe@pijul.org>"
7894+
"Darley Barreto <darleybarreto@gmail.com>"
78967895
];
78977896
dependencies = [
78987897
{
@@ -7904,15 +7903,12 @@ rec {
79047903
packageId = "thiserror";
79057904
}
79067905
{
7907-
name = "threadpool";
7908-
packageId = "threadpool";
7906+
name = "xxhash-rust";
7907+
packageId = "xxhash-rust";
7908+
features = [ "xxh64" ];
79097909
}
79107910
];
79117911
buildDependencies = [
7912-
{
7913-
name = "cc";
7914-
packageId = "cc";
7915-
}
79167912
{
79177913
name = "pkg-config";
79187914
packageId = "pkg-config";
@@ -7927,7 +7923,7 @@ rec {
79277923
#
79287924

79297925
/* Target (platform) data for conditional dependencies.
7930-
This corresponds roughly to what buildRustCrate is setting.
7926+
This corresponds roughly to what buildRustCrate is setting.
79317927
*/
79327928
defaultTarget = {
79337929
unix = true;
@@ -7999,14 +7995,16 @@ rec {
79997995
);
80007996

80017997
/* 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.
80037999
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
80068002
*/
8007-
crateWithTest = { crate, testCrate, testCrateFlags, testInputs }:
8003+
crateWithTest = { crate, testCrate, testCrateFlags, testInputs, testPreRun, testPostRun }:
80088004
assert builtins.typeOf testCrateFlags == "list";
80098005
assert builtins.typeOf testInputs == "list";
8006+
assert builtins.typeOf testPreRun == "string";
8007+
assert builtins.typeOf testPostRun == "string";
80108008
let
80118009
# override the `crate` so that it will build and execute tests instead of
80128010
# building the actual lib and bin targets We just have to pass `--test`
@@ -8020,6 +8018,15 @@ rec {
80208018
buildTests = true;
80218019
}
80228020
);
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+
]);
80238030
in
80248031
pkgs.runCommand "run-tests-${testCrate.name}"
80258032
{
@@ -8053,7 +8060,7 @@ rec {
80538060
for file in ${drv}/tests/*; do
80548061
f=$testRoot/$(basename $file)-$hash
80558062
cp $file $f
8056-
$f $testCrateFlags 2>&1 | tee -a $out
8063+
${testCommand}
80578064
done
80588065
'';
80598066
in
@@ -8077,6 +8084,10 @@ rec {
80778084
, runTests ? false
80788085
, testCrateFlags ? [ ]
80798086
, 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 ? ""
80808091
}:
80818092
lib.makeOverridable
80828093
(
@@ -8085,6 +8096,8 @@ rec {
80858096
, runTests
80868097
, testCrateFlags
80878098
, testInputs
8099+
, testPreRun
8100+
, testPostRun
80888101
}:
80898102
let
80908103
buildRustCrateForPkgsFuncOverriden =
@@ -8117,16 +8130,16 @@ rec {
81178130
{
81188131
crate = drv;
81198132
testCrate = testDrv;
8120-
inherit testCrateFlags testInputs;
8133+
inherit testCrateFlags testInputs testPreRun testPostRun;
81218134
}
81228135
else drv;
81238136
in
81248137
derivation
81258138
)
8126-
{ inherit features crateOverrides runTests testCrateFlags testInputs; };
8139+
{ inherit features crateOverrides runTests testCrateFlags testInputs testPreRun testPostRun; };
81278140

81288141
/* Returns an attr set with packageId mapped to the result of buildRustCrateForPkgsFunc
8129-
for the corresponding crate.
8142+
for the corresponding crate.
81308143
*/
81318144
builtRustCratesWithFeatures =
81328145
{ packageId
@@ -8264,7 +8277,7 @@ rec {
82648277
map depDerivation enabledDependencies;
82658278

82668279
/* Returns a sanitized version of val with all values substituted that cannot
8267-
be serialized as JSON.
8280+
be serialized as JSON.
82688281
*/
82698282
sanitizeForJson = val:
82708283
if builtins.isAttrs val
@@ -8309,9 +8322,9 @@ rec {
83098322
{ internal = debug; };
83108323

83118324
/* Returns differences between cargo default features and crate2nix default
8312-
features.
8325+
features.
83138326
8314-
This is useful for verifying the feature resolution in crate2nix.
8327+
This is useful for verifying the feature resolution in crate2nix.
83158328
*/
83168329
diffDefaultPackageFeatures =
83178330
{ crateConfigs ? crates
@@ -8348,8 +8361,8 @@ rec {
83488361

83498362
/* Returns an attrset mapping packageId to the list of enabled features.
83508363
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.
83538366
*/
83548367
mergePackageFeatures =
83558368
{ crateConfigs ? crates
@@ -8374,10 +8387,11 @@ rec {
83748387
let
83758388
crateConfig = crateConfigs."${packageId}" or (builtins.throw "Package not found: ${packageId}");
83768389
expandedFeatures = expandFeatures (crateConfig.features or { }) features;
8390+
enabledFeatures = enableFeatures (crateConfig.dependencies or [ ]) expandedFeatures;
83778391
depWithResolvedFeatures = dependency:
83788392
let
83798393
packageId = dependency.packageId;
8380-
features = dependencyFeatures expandedFeatures dependency;
8394+
features = dependencyFeatures enabledFeatures dependency;
83818395
in
83828396
{ inherit packageId features; };
83838397
resolveDependencies = cache: path: dependencies:
@@ -8386,7 +8400,7 @@ rec {
83868400
let
83878401
enabledDependencies = filterEnabledDependencies {
83888402
inherit dependencies target;
8389-
features = expandedFeatures;
8403+
features = enabledFeatures;
83908404
};
83918405
directDependencies = map depWithResolvedFeatures enabledDependencies;
83928406
foldOverCache = op: lib.foldl op cache directDependencies;
@@ -8410,7 +8424,7 @@ rec {
84108424
cacheWithSelf =
84118425
let
84128426
cacheFeatures = featuresByPackageId.${packageId} or [ ];
8413-
combinedFeatures = sortedUnique (cacheFeatures ++ expandedFeatures);
8427+
combinedFeatures = sortedUnique (cacheFeatures ++ enabledFeatures);
84148428
in
84158429
featuresByPackageId // {
84168430
"${packageId}" = combinedFeatures;
@@ -8462,10 +8476,10 @@ rec {
84628476
|| startsWithPrefix;
84638477

84648478
/* Returns the expanded features for the given inputFeatures by applying the
8465-
rules in featureMap.
8479+
rules in featureMap.
84668480
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.
84698483
*/
84708484
expandFeatures = featureMap: inputFeatures:
84718485
assert (builtins.isAttrs featureMap);
@@ -8478,10 +8492,32 @@ rec {
84788492
in
84798493
sortedUnique outFeatures;
84808494

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+
84818517
/*
8482-
Returns the actual features for the given dependency.
8518+
Returns the actual features for the given dependency.
84838519
8484-
features: The features of the crate that refers this dependency.
8520+
features: The features of the crate that refers this dependency.
84858521
*/
84868522
dependencyFeatures = features: dependency:
84878523
assert (builtins.isList features);
@@ -8520,6 +8556,6 @@ rec {
85208556
#
85218557
# crate2nix/default.nix (excerpt end)
85228558
#
8523-
85248559
};
8525-
}
8560+
}
8561+

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@
8282

8383
pijul = { ... }: {
8484
buildInputs = with pkgs; [
85-
xxHash
8685
zstd
8786
libsodium
87+
libiconv
8888
] ++ lib.optionals stdenv.isDarwin (
8989
[ openssl ]
9090
++ (with darwin.apple_sdk.frameworks; [

libpijul/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ twox-hash = "1.6"
116116
crossbeam-deque = "0.8"
117117
crossbeam-utils = "0.8"
118118

119-
zstd-seekable = { version = "0.2.0", optional = true }
119+
zstd-seekable = { version = "0.1.0", optional = true }
120120
cfg-if = "1.0"
121121
memchr = "2.4"
122122

0 commit comments

Comments
 (0)