dix dream-lock formatting in makeTranslateScript

This commit is contained in:
DavHau 2022-03-07 11:22:24 +07:00
parent dac0e8dba9
commit 058bc6cf9b
2 changed files with 22 additions and 9 deletions

View File

@ -152,11 +152,13 @@ let
coreutils
jq
nix
python3
]
''
jsonInputFile=$(realpath $1)
outputFile=$WORKDIR/$(jq '.outputFile' -c -r $jsonInputFile)
cd $WORKDIR
mkdir -p $(dirname $outputFile)
nix eval \
@ -180,7 +182,7 @@ let
(dreamLock // {
_generic = builtins.removeAttrs dreamLock._generic [ \"cyclicDependencies\" ];
})
" | jq > $outputFile
" | python3 ${../apps/cli2/format-dream-lock.py} > $outputFile
'';
in
bin.overrideAttrs (old: {

View File

@ -3,9 +3,12 @@
coreutils,
dlib,
fetchzip,
gitMinimal,
jq,
lib,
nix,
pkgs,
python3,
runCommand,
stdenv,
writeScript,
@ -185,21 +188,29 @@ overrideUtils
in
writePureShellScriptBin "resolve"
[
pkgs.coreutils
pkgs.jq
pkgs.gitMinimal
pkgs.nix
coreutils
jq
gitMinimal
nix
python3
]
''
dreamLockPath=${project.dreamLockPath}
cd $WORKDIR
${translator.translateBin} ${argsJsonFile}
# add invalidationHash to dream-lock.json
cp ${project.dreamLockPath} ${project.dreamLockPath}.tmp
cat ${project.dreamLockPath}.tmp \
cp $dreamLockPath $dreamLockPath.tmp
cat $dreamLockPath \
| jq '._generic.invalidationHash = "${invalidationHash}"' \
> ${project.dreamLockPath}
rm ${project.dreamLockPath}.tmp
> $dreamLockPath.tmp
cat $dreamLockPath.tmp \
| python3 ${../apps/cli2/format-dream-lock.py} \
> $dreamLockPath
rm $dreamLockPath.tmp
# add dream-lock.json to git
if git rev-parse --show-toplevel &>/dev/null; then