mirror of
https://github.com/ryanccn/flake.git
synced 2025-12-06 16:10:45 +01:00
fix(vscode): un-manage the app itself
This commit is contained in:
parent
5cf5ed65b7
commit
c7fbe30750
1 changed files with 16 additions and 3 deletions
|
|
@ -49,6 +49,14 @@
|
||||||
in {
|
in {
|
||||||
programs.vscode = {
|
programs.vscode = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.stdenv.mkDerivation {
|
||||||
|
pname = "vscode";
|
||||||
|
version = "1.81.1";
|
||||||
|
src = pkgs.emptyDirectory;
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extensions = [];
|
extensions = [];
|
||||||
mutableExtensionsDir = true;
|
mutableExtensionsDir = true;
|
||||||
|
|
@ -173,8 +181,13 @@ in {
|
||||||
|
|
||||||
home.activation = {
|
home.activation = {
|
||||||
vscodeExtensions = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
vscodeExtensions = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
|
if ! command -v "code" &> /dev/null; then
|
||||||
|
echo "code CLI is not available"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
declare -A currentExtensions
|
declare -A currentExtensions
|
||||||
for extension in $(${pkgs.vscode}/bin/code --list-extensions); do
|
for extension in $(code --list-extensions); do
|
||||||
currentExtensions["$extension"]=1;
|
currentExtensions["$extension"]=1;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
@ -185,7 +198,7 @@ in {
|
||||||
(ext: ''
|
(ext: ''
|
||||||
if [[ -z "''${currentExtensions[${ext}]+unset}" ]]; then
|
if [[ -z "''${currentExtensions[${ext}]+unset}" ]]; then
|
||||||
echo "installing ${ext}"
|
echo "installing ${ext}"
|
||||||
${pkgs.vscode}/bin/code --install-extension ${ext} &> /dev/null
|
code --install-extension ${ext} &> /dev/null
|
||||||
fi
|
fi
|
||||||
unset 'currentExtensions[${ext}]'
|
unset 'currentExtensions[${ext}]'
|
||||||
'')
|
'')
|
||||||
|
|
@ -194,7 +207,7 @@ in {
|
||||||
|
|
||||||
for ext in "''${!currentExtensions[@]}"; do
|
for ext in "''${!currentExtensions[@]}"; do
|
||||||
echo "uninstalling $ext"
|
echo "uninstalling $ext"
|
||||||
${pkgs.vscode}/bin/code --uninstall-extension $ext &> /dev/null
|
code --uninstall-extension $ext &> /dev/null
|
||||||
currentExtensions[$ext]=
|
currentExtensions[$ext]=
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue