1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-20 16:59: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:
Naïm Favier 2022-07-15 16:29:10 +02:00 committed by Robert Helgesson
parent 0b7fd187e2
commit 119febc464
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -180,22 +180,24 @@ in {
(map dropNullFields cfg.keybindings); (map dropNullFields cfg.keybindings);
})) }))
(mkIf (cfg.extensions != [ ]) (let (mkIf (cfg.extensions != [ ]) (let
combinedExtensionsDrv = pkgs.buildEnv { subDir = "share/vscode/extensions";
name = "vscode-extensions";
paths = cfg.extensions;
};
extensionsFolder = "${combinedExtensionsDrv}/share/vscode/extensions";
# Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2 # Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2
addSymlinkToExtension = k: { toPaths = ext:
"${extensionPath}/${k}".source = "${extensionsFolder}/${k}"; map (k: { "${extensionPath}/${k}".source = "${ext}/${subDir}/${k}"; })
}; (if ext ? vscodeExtUniqueId then
extensions = builtins.attrNames (builtins.readDir extensionsFolder); [ ext.vscodeExtUniqueId ]
else
builtins.attrNames (builtins.readDir (ext + "/${subDir}")));
in if cfg.mutableExtensionsDir then in if cfg.mutableExtensionsDir then
mkMerge (map addSymlinkToExtension extensions) mkMerge (concatMap toPaths cfg.extensions)
else { else {
"${extensionPath}".source = extensionsFolder; "${extensionPath}".source = let
combinedExtensionsDrv = pkgs.buildEnv {
name = "vscode-extensions";
paths = cfg.extensions;
};
in "${combinedExtensionsDrv}/${subDir}";
})) }))
]; ];
}; };