mirror of
https://github.com/nix-community/home-manager
synced 2024-12-21 01:09:47 +01:00
vscode: avoid unnecessary IFD (again)
Fixed in https://github.com/nix-community/home-manager/pull/2506 then unfixed in https://github.com/nix-community/home-manager/pull/2613
This commit is contained in:
parent
0b7fd187e2
commit
119febc464
1 changed files with 14 additions and 12 deletions
|
@ -180,22 +180,24 @@ in {
|
||||||
(map dropNullFields cfg.keybindings);
|
(map dropNullFields cfg.keybindings);
|
||||||
}))
|
}))
|
||||||
(mkIf (cfg.extensions != [ ]) (let
|
(mkIf (cfg.extensions != [ ]) (let
|
||||||
|
subDir = "share/vscode/extensions";
|
||||||
|
|
||||||
|
# Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2
|
||||||
|
toPaths = ext:
|
||||||
|
map (k: { "${extensionPath}/${k}".source = "${ext}/${subDir}/${k}"; })
|
||||||
|
(if ext ? vscodeExtUniqueId then
|
||||||
|
[ ext.vscodeExtUniqueId ]
|
||||||
|
else
|
||||||
|
builtins.attrNames (builtins.readDir (ext + "/${subDir}")));
|
||||||
|
in if cfg.mutableExtensionsDir then
|
||||||
|
mkMerge (concatMap toPaths cfg.extensions)
|
||||||
|
else {
|
||||||
|
"${extensionPath}".source = let
|
||||||
combinedExtensionsDrv = pkgs.buildEnv {
|
combinedExtensionsDrv = pkgs.buildEnv {
|
||||||
name = "vscode-extensions";
|
name = "vscode-extensions";
|
||||||
paths = cfg.extensions;
|
paths = cfg.extensions;
|
||||||
};
|
};
|
||||||
|
in "${combinedExtensionsDrv}/${subDir}";
|
||||||
extensionsFolder = "${combinedExtensionsDrv}/share/vscode/extensions";
|
|
||||||
|
|
||||||
# Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2
|
|
||||||
addSymlinkToExtension = k: {
|
|
||||||
"${extensionPath}/${k}".source = "${extensionsFolder}/${k}";
|
|
||||||
};
|
|
||||||
extensions = builtins.attrNames (builtins.readDir extensionsFolder);
|
|
||||||
in if cfg.mutableExtensionsDir then
|
|
||||||
mkMerge (map addSymlinkToExtension extensions)
|
|
||||||
else {
|
|
||||||
"${extensionPath}".source = extensionsFolder;
|
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue