3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/perl-modules/expression-generator/write-nix-expression.sh
Victor Engmark 57b496ea98 misc: Replace tab indentation with spaces
I've tried to be consistent, using four or eight spaces to line up
with existing code.
2021-11-14 16:04:46 +13:00

35 lines
908 B
Bash
Executable file

#! /bin/sh
cd $(dirname $0);
source lib-cache.sh;
print_expression () {
module_name="$1";
module_basename="${module_name//::/-}";
module_compressedname="perl${module_name//::/}";
sourcelink="$(./source-download-link.sh "${module_name}")";
version_name="${sourcelink%.tar.*}";
version_name="${version_name##*/}";
dependencies="$(./filtered-requirements.sh "$module_name" | sed -e 's/^/perl/; s/:://g' | xargs)";
source_hash=$(nix-prefetch-url "$sourcelink" 2>/dev/null);
cat <<EOF
${module_compressedname} = import ../development/perl-modules/generic perl {
name = "${version_name}";
src = fetchurl {
url = ${sourcelink};
sha256 = "$source_hash";
};
propagatedBuildInputs = [${dependencies}];
};
EOF
};
module_name="$1";
module_basename="${module_name//::/-}";
cached_output print_expression "$module_basename" "$module_name" "nix";