Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{ lib
, stdenvNoCC
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format with the new formatter. Other than that the PR looks good.

, shellcheck
, coreutils
, curl
, jq
, nix
, unzip
}:

stdenvNoCC.mkDerivation {
pname = "nix-prefetch-vsix-lib";
version = "0.1.0";

preferLocalBuild = true;

src = [
./nix-prefetch-vsix-lib.sh
];

dontUnpack = true;

installPhase = ''
runHook preInstall
mkdir -p "$out/bin"
substitute "$src" "$out/bin/$(stripHash "$src")" \
--replace "###PLACEHOLDER_PATH_PREFIXING###" "PATH=\"${lib.makeBinPath [
coreutils
curl
jq
nix
unzip
]}\''${PATH:+:}\''${PATH-}\"; export PATH"
runHook postInstall
'';

doInstallCheck = true;

installCheckInputs = [
shellcheck
];

installCheckPhase = ''
runHook preInstallCheck

# Run through shellcheck
while IFS= read -r -d "" file; do
shellcheck --shell=bash "$file"
done < <(find "$out/bin" -mindepth 1 -type f,l -print0)

# Test sourcing
(
set -eu -o pipefail
source "$out/bin/nix-prefetch-vsix-lib.sh"
)

runHook postInstallCheck
'';

meta = with lib; {
description = "Bash library to construct a VSCode extension fetcher";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ ShamrockLee ];
};
}
Loading