vscode-extensions: editorconfig fixes
This commit is contained in:
parent
5c67236602
commit
322f0bd565
@ -16,7 +16,7 @@ let
|
||||
|
||||
updateVSCodeSettingsCmd = ''
|
||||
(
|
||||
echo 'updateSettings.nix: Updating ${vscodeSettingsFile}...'
|
||||
echo 'updateSettings.nix: Updating ${vscodeSettingsFile}...'
|
||||
oldSettings=$(cat ${vscodeSettingsFile})
|
||||
echo $oldSettings' ${builtins.toJSON settings}' | ${jq}/bin/jq -s add > ${vscodeSettingsFile}
|
||||
)'';
|
||||
@ -25,10 +25,10 @@ let
|
||||
fileName = builtins.baseNameOf vscodeSettingsFile;
|
||||
symlinkFromUserSettingCmd = lib.optionalString symlinkFromUserSetting
|
||||
'' && mkdir -p "${userSettingsFolder}" && ln -sfv "$(pwd)/${vscodeSettingsFile}" "${userSettingsFolder}/" '';
|
||||
in
|
||||
in
|
||||
|
||||
writeShellScriptBin ''vscodeNixUpdate-${lib.removeSuffix ".json" (fileName)}''
|
||||
(lib.optionalString (settings != {})
|
||||
(lib.optionalString (settings != {})
|
||||
(if createIfDoesNotExists then ''
|
||||
[ ! -f "${vscodeSettingsFile}" ] && ${createEmptySettingsCmd}
|
||||
${updateVSCodeSettingsCmd} ${symlinkFromUserSettingCmd}
|
||||
|
@ -21,13 +21,13 @@
|
||||
, user-data-dir ? ''"''${TMP}''${name}"/vscode-data-dir''
|
||||
# if file exists will use it and import the extensions in it into this dervation else will use empty extensions list
|
||||
# this file will be created/updated by vscodeExts2nix when vscode exists
|
||||
, mutableExtensionsFile
|
||||
, mutableExtensionsFile
|
||||
}:
|
||||
let
|
||||
let
|
||||
mutableExtensionsFilePath = toString mutableExtensionsFile;
|
||||
mutableExtensions = if builtins.pathExists mutableExtensionsFile
|
||||
mutableExtensions = if builtins.pathExists mutableExtensionsFile
|
||||
then import mutableExtensionsFilePath else [];
|
||||
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
||||
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
||||
inherit lib writeShellScriptBin extensionsFromVscodeMarketplace;
|
||||
vscodeDefault = vscode;
|
||||
}
|
||||
@ -63,19 +63,19 @@ let
|
||||
symlinkFromUserSetting = (user-data-dir != "");
|
||||
};
|
||||
|
||||
vscodeExts2nix = import ./vscodeExts2nix.nix {
|
||||
vscodeExts2nix = import ./vscodeExts2nix.nix {
|
||||
inherit lib writeShellScriptBin;
|
||||
vscodeDefault = vscodeWithConfiguration;
|
||||
}
|
||||
{
|
||||
extensionsToIgnore = nixExtensions;
|
||||
extensions = mutableExtensions;
|
||||
extensions = mutableExtensions;
|
||||
};
|
||||
code = writeShellScriptBin "code" ''
|
||||
${updateSettingsCmd}/bin/vscodeNixUpdate-settings
|
||||
${updateLaunchCmd}/bin/vscodeNixUpdate-launch
|
||||
${updateKeybindingsCmd}/bin/vscodeNixUpdate-keybindings
|
||||
${vscodeWithConfiguration}/bin/code --wait "$@"
|
||||
${vscodeWithConfiguration}/bin/code --wait "$@"
|
||||
echo 'running vscodeExts2nix to update ${mutableExtensionsFilePath}...'
|
||||
${vscodeExts2nix}/bin/vscodeExts2nix > ${mutableExtensionsFilePath}
|
||||
'';
|
||||
|
@ -1,5 +1,5 @@
|
||||
with import <nixpkgs>{};
|
||||
callPackage (import ./vscodeEnv.nix) {
|
||||
callPackage (import ./vscodeEnv.nix) {
|
||||
extensionsFromVscodeMarketplace = vscode-utils.extensionsFromVscodeMarketplace;
|
||||
vscodeDefault = vscode;
|
||||
} {
|
||||
@ -9,4 +9,3 @@ callPackage (import ./vscodeEnv.nix) {
|
||||
t = "test";
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
# based on the passed vscode will stdout a nix expression with the installed vscode extensions
|
||||
# based on the passed vscode will stdout a nix expression with the installed vscode extensions
|
||||
{ lib
|
||||
, vscodeDefault
|
||||
, writeShellScriptBin
|
||||
}:
|
||||
|
||||
##User input
|
||||
{ vscode ? vscodeDefault
|
||||
{ vscode ? vscodeDefault
|
||||
, extensionsToIgnore ? []
|
||||
# will use those extensions to get sha256 if still exists when executed.
|
||||
, extensions ? []
|
||||
, extensions ? []
|
||||
}:
|
||||
let
|
||||
let
|
||||
mktplcExtRefToFetchArgs = import ./mktplcExtRefToFetchArgs.nix;
|
||||
in
|
||||
writeShellScriptBin "vscodeExts2nix" ''
|
||||
echo '['
|
||||
echo '['
|
||||
|
||||
for line in $(${vscode}/bin/code --list-extensions --show-versions \
|
||||
${lib.optionalString (extensionsToIgnore != []) ''
|
||||
| grep -v -i '^\(${lib.concatMapStringsSep "\\|" (e : ''${e.publisher}.${e.name}'') extensionsToIgnore}\)'
|
||||
| grep -v -i '^\(${lib.concatMapStringsSep "\\|" (e : ''${e.publisher}.${e.name}'') extensionsToIgnore}\)'
|
||||
''}
|
||||
) ; do
|
||||
[[ $line =~ ([^.]*)\.([^@]*)@(.*) ]]
|
||||
|
@ -1,22 +1,22 @@
|
||||
# wrapper over vscode to control extensions per project (extensions folder will be created in execution path)
|
||||
{ lib
|
||||
, writeShellScriptBin
|
||||
, extensionsFromVscodeMarketplace
|
||||
{ lib
|
||||
, writeShellScriptBin
|
||||
, extensionsFromVscodeMarketplace
|
||||
, vscodeDefault
|
||||
}:
|
||||
## User input
|
||||
{ vscode ? vscodeDefault
|
||||
{ vscode ? vscodeDefault
|
||||
# extensions to be symlinked into the project's extensions folder
|
||||
, nixExtensions ? []
|
||||
, nixExtensions ? []
|
||||
# extensions to be copied into the project's extensions folder
|
||||
, mutableExtensions ? []
|
||||
, vscodeExtsFolderName ? ".vscode-exts"
|
||||
, mutableExtensions ? []
|
||||
, vscodeExtsFolderName ? ".vscode-exts"
|
||||
, user-data-dir ? ''"''${TMP}vscodeWithConfiguration/vscode-data-dir"''
|
||||
}:
|
||||
let
|
||||
let
|
||||
nixExtsDrvs = extensionsFromVscodeMarketplace nixExtensions;
|
||||
mutExtsDrvs = extensionsFromVscodeMarketplace mutableExtensions;
|
||||
mutableExtsPaths = lib.forEach mutExtsDrvs ( e:
|
||||
mutableExtsPaths = lib.forEach mutExtsDrvs ( e:
|
||||
{
|
||||
origin = ''${e}/share/vscode/extensions/${e.vscodeExtUniqueId}'';
|
||||
target = ''${vscodeExtsFolderName}/${e.vscodeExtUniqueId}-${(lib.findSingle (ext: ''${ext.publisher}.${ext.name}'' == e.vscodeExtUniqueId) "" "m" mutableExtensions ).version}'';
|
||||
@ -39,16 +39,16 @@ let
|
||||
cp -a ${ePath.origin} ${ePath.target}
|
||||
chmod -R u+rwx ${ePath.target}
|
||||
fi
|
||||
'') mutableExtsPaths}
|
||||
'') mutableExtsPaths}
|
||||
'';
|
||||
in
|
||||
writeShellScriptBin "code" ''
|
||||
if ! [[ "$@" =~ "--list-extension" ]]; then
|
||||
mkdir -p "${vscodeExtsFolderName}"
|
||||
if ! [[ "$@" =~ "--list-extension" ]]; then
|
||||
mkdir -p "${vscodeExtsFolderName}"
|
||||
${rmExtensions}
|
||||
${cpExtensions}
|
||||
fi
|
||||
${vscode}/bin/code --extensions-dir "${vscodeExtsFolderName}" ${
|
||||
${vscode}/bin/code --extensions-dir "${vscodeExtsFolderName}" ${
|
||||
lib.optionalString (user-data-dir != "") ''--user-data-dir ${user-data-dir }''
|
||||
} "$@"
|
||||
''
|
||||
|
Loading…
Reference in New Issue
Block a user