1 # based on the passed vscode will stdout a nix expression with the installed vscode extensions
10 vscode ? vscodeDefault,
11 extensionsToIgnore ? [ ],
12 # will use those extensions to get sha256 if still exists when executed.
16 mktplcExtRefToFetchArgs = import ./mktplcExtRefToFetchArgs.nix;
18 writeShellScriptBin "vscodeExts2nix" ''
21 for line in $(${vscode}/bin/code --list-extensions --show-versions \
22 ${lib.optionalString (extensionsToIgnore != [ ]) ''
24 lib.concatMapStringsSep "\\|" (e: "${e.publisher}.${e.name}") extensionsToIgnore
28 [[ $line =~ ([^.]*)\.([^@]*)@(.*) ]]
29 name=''${BASH_REMATCH[2]}
30 publisher=''${BASH_REMATCH[1]}
31 version=''${BASH_REMATCH[3]}
33 extensions="${lib.concatMapStringsSep "." (e: "${e.publisher}${e.name}@${e.sha256}") extensions}"
34 reCurrentExt=$publisher$name"@([^.]*)"
35 if [[ $extensions =~ $reCurrentExt ]]; then
36 sha256=''${BASH_REMATCH[1]}
40 (mktplcExtRefToFetchArgs {
41 publisher = ''"$publisher"'';
43 version = ''"$version"'';
49 echo "{ name = \"''${name}\"; publisher = \"''${publisher}\"; version = \"''${version}\"; sha256 = \"''${sha256}\"; }"