1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

vscode: fix keybindings existence check (#2707)

... and flip immutableExtensionsDir to mutableExtensionsDir
This commit is contained in:
Naïm Favier 2022-02-07 18:40:59 +01:00 committed by GitHub
parent 63dccc4e60
commit 1ca6293c8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,6 +34,14 @@ let
extensionPath = ".${extensionDir}/extensions";
in {
imports = [
(mkChangedOptionModule [ "programs" "vscode" "immutableExtensionsDir" ] [
"programs"
"vscode"
"mutableExtensionsDir"
] (config: !config.programs.vscode.immutableExtensionsDir))
];
options = {
programs.vscode = {
enable = mkEnableOption "Visual Studio Code";
@ -118,10 +126,10 @@ in {
'';
};
immutableExtensionsDir = mkOption {
mutableExtensionsDir = mkOption {
type = types.bool;
default = false;
example = true;
default = true;
example = false;
description = ''
Whether extensions can be installed or updated manually
or by Visual Studio Code.
@ -138,7 +146,7 @@ in {
"${configFilePath}".source =
jsonFormat.generate "vscode-user-settings" cfg.userSettings;
})
(mkIf (cfg.keybindings != { })
(mkIf (cfg.keybindings != [ ])
(let dropNullFields = filterAttrs (_: v: v != null);
in {
"${keybindingsFilePath}".source =
@ -158,10 +166,11 @@ in {
"${extensionPath}/${k}".source = "${extensionsFolder}/${k}";
};
extensions = builtins.attrNames (builtins.readDir extensionsFolder);
in if cfg.immutableExtensionsDir then {
in if cfg.mutableExtensionsDir then
mkMerge (map addSymlinkToExtension extensions)
else {
"${extensionPath}".source = extensionsFolder;
} else
mkMerge (map addSymlinkToExtension extensions)))
}))
];
};
}