1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01: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) {