vscode: add module

This commit is contained in:
hyperfekt 2018-11-19 17:50:35 +01:00 committed by Robert Helgesson
parent ffdbefe22c
commit 6ab6488e5a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 60 additions and 0 deletions

View file

@ -871,6 +871,13 @@ in
A new module is available: 'services.nextcloud-client'. A new module is available: 'services.nextcloud-client'.
''; '';
} }
{
time = "2018-11-25T22:55:12+00:00";
message = ''
A new module is available: 'programs.vscode'.
'';
}
]; ];
}; };
} }

View file

@ -67,6 +67,7 @@ let
./programs/tmux.nix ./programs/tmux.nix
./programs/urxvt.nix ./programs/urxvt.nix
./programs/vim.nix ./programs/vim.nix
./programs/vscode.nix
./programs/zathura.nix ./programs/zathura.nix
./programs/zsh.nix ./programs/zsh.nix
./services/blueman-applet.nix ./services/blueman-applet.nix

View file

@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.vscode;
in
{
options = {
programs.vscode = {
enable = mkEnableOption "Visual Studio Code";
userSettings = mkOption {
type = types.attrs;
default = {};
example = literalExample ''
{
"update.channel" = "none";
"[nix]"."editor.tabSize" = 2;
}
'';
description = ''
Configuration written to
<filename>~/.config/Code/User/settings.json</filename>.
'';
};
extensions = mkOption {
type = types.listOf types.package;
default = [];
description = ''
The extensions Visual Studio Code should be started with.
These will override but not delete manually installed ones.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [
(pkgs.vscode-with-extensions.override {
vscodeExtensions = cfg.extensions;
})
];
xdg.configFile."Code/User/settings.json".text =
builtins.toJSON cfg.userSettings;
};
}