mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
vscode: fix keybindings existence check (#2707)
... and flip immutableExtensionsDir to mutableExtensionsDir
This commit is contained in:
parent
63dccc4e60
commit
1ca6293c8f
1 changed files with 16 additions and 7 deletions
|
@ -34,6 +34,14 @@ let
|
||||||
extensionPath = ".${extensionDir}/extensions";
|
extensionPath = ".${extensionDir}/extensions";
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
imports = [
|
||||||
|
(mkChangedOptionModule [ "programs" "vscode" "immutableExtensionsDir" ] [
|
||||||
|
"programs"
|
||||||
|
"vscode"
|
||||||
|
"mutableExtensionsDir"
|
||||||
|
] (config: !config.programs.vscode.immutableExtensionsDir))
|
||||||
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
programs.vscode = {
|
programs.vscode = {
|
||||||
enable = mkEnableOption "Visual Studio Code";
|
enable = mkEnableOption "Visual Studio Code";
|
||||||
|
@ -118,10 +126,10 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
immutableExtensionsDir = mkOption {
|
mutableExtensionsDir = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = true;
|
||||||
example = true;
|
example = false;
|
||||||
description = ''
|
description = ''
|
||||||
Whether extensions can be installed or updated manually
|
Whether extensions can be installed or updated manually
|
||||||
or by Visual Studio Code.
|
or by Visual Studio Code.
|
||||||
|
@ -138,7 +146,7 @@ in {
|
||||||
"${configFilePath}".source =
|
"${configFilePath}".source =
|
||||||
jsonFormat.generate "vscode-user-settings" cfg.userSettings;
|
jsonFormat.generate "vscode-user-settings" cfg.userSettings;
|
||||||
})
|
})
|
||||||
(mkIf (cfg.keybindings != { })
|
(mkIf (cfg.keybindings != [ ])
|
||||||
(let dropNullFields = filterAttrs (_: v: v != null);
|
(let dropNullFields = filterAttrs (_: v: v != null);
|
||||||
in {
|
in {
|
||||||
"${keybindingsFilePath}".source =
|
"${keybindingsFilePath}".source =
|
||||||
|
@ -158,10 +166,11 @@ in {
|
||||||
"${extensionPath}/${k}".source = "${extensionsFolder}/${k}";
|
"${extensionPath}/${k}".source = "${extensionsFolder}/${k}";
|
||||||
};
|
};
|
||||||
extensions = builtins.attrNames (builtins.readDir extensionsFolder);
|
extensions = builtins.attrNames (builtins.readDir extensionsFolder);
|
||||||
in if cfg.immutableExtensionsDir then {
|
in if cfg.mutableExtensionsDir then
|
||||||
|
mkMerge (map addSymlinkToExtension extensions)
|
||||||
|
else {
|
||||||
"${extensionPath}".source = extensionsFolder;
|
"${extensionPath}".source = extensionsFolder;
|
||||||
} else
|
}))
|
||||||
mkMerge (map addSymlinkToExtension extensions)))
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue