1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-28 17:38:33 +02:00

vscode: avoid unnecessary IFD (#2506)

This commit is contained in:
Naïm Favier 2021-11-25 02:55:38 +01:00 committed by GitHub
parent 609370699f
commit e28185a2c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,11 +127,13 @@ in {
# Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2
home.file = let
subDir = "share/vscode/extensions";
toPaths = path:
# Links every dir in path to the extension path.
mapAttrsToList
(k: _: { "${extensionPath}/${k}".source = "${path}/${subDir}/${k}"; })
(builtins.readDir (path + "/${subDir}"));
toPaths = ext:
# Links every dir in ext to the extension path.
map (k: { "${extensionPath}/${k}".source = "${ext}/${subDir}/${k}"; })
(if ext ? vscodeExtUniqueId then
[ ext.vscodeExtUniqueId ]
else
builtins.attrNames (builtins.readDir (ext + "/${subDir}")));
toSymlink = concatMap toPaths cfg.extensions;
dropNullFields = filterAttrs (_: v: v != null);
in foldr (a: b: a // b) {