1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

vscode: add user tasks (#2804)

This commit is contained in:
mihnea-s 2022-03-19 00:54:24 +02:00 committed by GitHub
parent e2a85ac43f
commit 7cf15b19a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,6 +28,7 @@ let
"${config.xdg.configHome}/${configDir}/User"; "${config.xdg.configHome}/${configDir}/User";
configFilePath = "${userDir}/settings.json"; configFilePath = "${userDir}/settings.json";
tasksFilePath = "${userDir}/tasks.json";
keybindingsFilePath = "${userDir}/keybindings.json"; keybindingsFilePath = "${userDir}/keybindings.json";
# TODO: On Darwin where are the extensions? # TODO: On Darwin where are the extensions?
@ -70,6 +71,27 @@ in {
''; '';
}; };
userTasks = mkOption {
type = jsonFormat.type;
default = { };
example = literalExpression ''
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Hello task",
"command": "hello",
}
]
}
'';
description = ''
Configuration written to Visual Studio Code's
<filename>tasks.json</filename>.
'';
};
keybindings = mkOption { keybindings = mkOption {
type = types.listOf (types.submodule { type = types.listOf (types.submodule {
options = { options = {
@ -146,6 +168,10 @@ in {
"${configFilePath}".source = "${configFilePath}".source =
jsonFormat.generate "vscode-user-settings" cfg.userSettings; jsonFormat.generate "vscode-user-settings" cfg.userSettings;
}) })
(mkIf (cfg.userTasks != { }) {
"${tasksFilePath}".source =
jsonFormat.generate "vscode-user-tasks" cfg.userTasks;
})
(mkIf (cfg.keybindings != [ ]) (mkIf (cfg.keybindings != [ ])
(let dropNullFields = filterAttrs (_: v: v != null); (let dropNullFields = filterAttrs (_: v: v != null);
in { in {