mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-27 16:33:05 +03:00
fix: aggregated fetching
This commit is contained in:
parent
553d29724f
commit
5ad6855226
@ -97,38 +97,46 @@ let
|
||||
else
|
||||
""
|
||||
else if lib.isList x then
|
||||
builtins.toString (lib.forEach x (y: toString y))
|
||||
''"${lib.concatStringsSep " " (lib.forEach x (y: toString' y))}"''
|
||||
else if x == null then
|
||||
""
|
||||
else
|
||||
builtins.toJSON x;
|
||||
b.toJSON x;
|
||||
|
||||
# generate script to fetch single item
|
||||
fetchItem = fetcherArgs: ''
|
||||
# set up nix build env for signle item
|
||||
setupEnvForItem = fetcherArgs: ''
|
||||
|
||||
# export arguments for builder
|
||||
${lib.concatStringsSep "\n" (lib.mapAttrsToList (argName: argVal: ''
|
||||
export ${argName}=${toString' argVal}
|
||||
export ${argName}=${
|
||||
lib.replaceStrings [ "$" ''\n'' ] [ ''\$'' "\n" ] (toString' argVal)}
|
||||
'') fetcherArgs)}
|
||||
|
||||
# run builder
|
||||
bash ${fetcherArgs.builder}
|
||||
'';
|
||||
|
||||
mkScriptItem = fetcherArgs: ''
|
||||
mkScriptForItem = fetcherArgs: ''
|
||||
# configure $out
|
||||
OUT_ORIG=$out
|
||||
export out=$OUT_ORIG/${fetcherArgs.outPath}
|
||||
mkdir -p $(dirname $out)
|
||||
|
||||
# set up TMP and TMPDIR
|
||||
workdir=$(mktemp -d)
|
||||
TMP=$workdir/TMP
|
||||
TMPDIR=$TMP
|
||||
mkdir -p $TMP
|
||||
|
||||
# do the work
|
||||
pushd $workdir
|
||||
${fetchItem fetcherArgs}
|
||||
${setupEnvForItem fetcherArgs}
|
||||
popd
|
||||
rm -r $workdir
|
||||
'';
|
||||
|
||||
# builder which wraps several other FOD builders
|
||||
# and executes these after each other inside a single build
|
||||
# TODO: for some reason PATH is unset and we don't have access to the stdenv tools
|
||||
builder = writeScript "multi-source-fetcher" ''
|
||||
#!${bash}/bin/bash
|
||||
export PATH=${coreutils}/bin:${bash}/bin
|
||||
@ -142,13 +150,13 @@ let
|
||||
${lib.concatStringsSep "\n"
|
||||
(b.map
|
||||
(fetcherArgs: ''
|
||||
$async -s="$S" cmd -- bash -c '${mkScriptItem fetcherArgs}'
|
||||
$async -s="$S" cmd -- bash -c '${mkScriptForItem fetcherArgs}'
|
||||
'')
|
||||
FODArgsAllList)}
|
||||
|
||||
$async -s="$S" wait
|
||||
|
||||
echo "FOD_HASH=$(${nix}/bin/nix hash-path $out)"
|
||||
echo "FOD_HASH=$(${nix}/bin/nix hash path $out)"
|
||||
'';
|
||||
|
||||
FODAllSources =
|
||||
|
@ -11,7 +11,7 @@ let
|
||||
fetchAggrgatedGithub =
|
||||
dream2nix.utils.toDrv
|
||||
(dream2nix.fetchSources {
|
||||
dreamLock = ./prettier.json;
|
||||
dreamLock = ./prettier-github-aggregated.json;
|
||||
}).fetchedSources.prettier."2.4.1";
|
||||
|
||||
in
|
||||
|
@ -2,7 +2,7 @@
|
||||
"_generic": {
|
||||
"mainPackageName": "prettier",
|
||||
"mainPackageVersion": "2.4.1",
|
||||
"sourcesAggregatedHash": "sha256-AR5QtVJE15NCLJpjWdg6UxhIEwFGsCAne5TI3DcOMeI=",
|
||||
"sourcesAggregatedHash": "sha256-ro6ysaTWAtUtKO0w3y7YFMq99nkOwucuwlKLBiFyuZ0=",
|
||||
"subsystem": "nodejs",
|
||||
"translatedBy": "nodejs.pure.yarn-lock",
|
||||
"translator": "yarn-lock",
|
Loading…
Reference in New Issue
Block a user