buildDotnetModule.fetch-deps: use json lockfiles by default
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
substituteAll,
|
||||
nuget-to-nix,
|
||||
nixfmt-rfc-style,
|
||||
nuget-to-json,
|
||||
cacert,
|
||||
fetchNupkg,
|
||||
callPackage,
|
||||
@@ -87,8 +88,11 @@ attrs
|
||||
src = ./fetch-deps.sh;
|
||||
isExecutable = true;
|
||||
inherit cacert;
|
||||
nugetToNix = nuget-to-nix;
|
||||
nixfmt = nixfmt-rfc-style;
|
||||
binPath = lib.makeBinPath [
|
||||
nuget-to-nix
|
||||
nixfmt-rfc-style
|
||||
nuget-to-json
|
||||
];
|
||||
};
|
||||
|
||||
defaultDepsFile =
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
set -e
|
||||
# shellcheck shell=bash
|
||||
set -euo pipefail
|
||||
|
||||
export PATH="@binPath@:$PATH"
|
||||
|
||||
LOCKFILE_OUTPUT="$1"
|
||||
|
||||
genericBuild
|
||||
|
||||
(
|
||||
echo -e "# This file was automatically generated by passthru.fetch-deps.\n# Please dont edit it manually, your changes might get overwritten!\n"
|
||||
@nugetToNix@/bin/nuget-to-nix "${NUGET_PACKAGES%/}"
|
||||
) > deps.nix
|
||||
nuget-to-json "${NUGET_PACKAGES%/}" >deps.json
|
||||
|
||||
@nixfmt@/bin/nixfmt deps.nix
|
||||
if [[ "$LOCKFILE_OUTPUT" == *.nix ]]; then
|
||||
trap 'rm deps.json' exit
|
||||
|
||||
mv deps.nix "$1"
|
||||
echo "Succesfully wrote lockfile to $1"
|
||||
(
|
||||
echo "# This file was automatically generated by passthru.fetch-deps."
|
||||
echo "# Please dont edit it manually, your changes might get overwritten!"
|
||||
echo -e "# TODO: This format file is obsolete, consider migrating to JSON.\n"
|
||||
nuget-to-nix --convert deps.json
|
||||
) >deps.nix
|
||||
nixfmt deps.nix
|
||||
|
||||
mv deps.nix "$LOCKFILE_OUTPUT"
|
||||
else
|
||||
mv deps.json "$LOCKFILE_OUTPUT"
|
||||
fi
|
||||
|
||||
echo "Succesfully wrote lockfile to $LOCKFILE_OUTPUT"
|
||||
|
||||
Reference in New Issue
Block a user