summaryrefslogtreecommitdiff
path: root/modules/vscode.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
committerAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
commite6ed60548397627bf10f561f9438201dbba0a36e (patch)
treef9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/vscode.nix
parent9ac64328603d44bd272175942d3ea3eaadcabd04 (diff)
2024-04-21
Diffstat (limited to 'modules/vscode.nix')
-rw-r--r--modules/vscode.nix244
1 files changed, 244 insertions, 0 deletions
diff --git a/modules/vscode.nix b/modules/vscode.nix
new file mode 100644
index 0000000..bd840d8
--- /dev/null
+++ b/modules/vscode.nix
@@ -0,0 +1,244 @@
+{
+ config,
+ inputs,
+ lib,
+ pkgs,
+ ...
+}:
+with lib;
+let
+ cfg = config.nixfiles.modules.vscode;
+in
+{
+ options.nixfiles.modules.vscode = {
+ enable = mkEnableOption "VSCode";
+
+ package =
+ with pkgs;
+ mkOption {
+ type = types.enum [
+ vscodium
+ vscode
+ vscode-fhs
+ ];
+ default = vscodium;
+ description = "Which package to use as a VSCode implementation.";
+ };
+
+ vim.enable = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Whether to enable Vim emulation.";
+ };
+ };
+
+ config = mkIf cfg.enable {
+ hm = {
+ stylix.targets.vscode.enable = false;
+
+ programs.vscode =
+ with config.nixfiles;
+ with modules;
+ with profiles;
+ {
+ enable = true;
+
+ inherit (cfg) package;
+
+ extensions =
+ with pkgs.open-vsx;
+ [
+ editorconfig.editorconfig
+ efoerster.texlab
+ github.vscode-pull-request-github
+ gitlab.gitlab-workflow
+ golang.go
+ graphql.vscode-graphql
+ graphql.vscode-graphql-execution
+ graphql.vscode-graphql-syntax
+ hashicorp.hcl
+ hashicorp.terraform
+ haskell.haskell
+ jnoortheen.nix-ide
+ kahole.magit
+ mads-hartmann.bash-ide-vscode
+ mkhl.direnv
+ ms-kubernetes-tools.vscode-kubernetes-tools
+ ms-python.python
+ redhat.ansible
+ redhat.vscode-xml
+ redhat.vscode-yaml
+ rust-lang.rust
+ signageos.signageos-vscode-sops
+ skellock.just
+ streetsidesoftware.code-spell-checker
+ streetsidesoftware.code-spell-checker-british-english
+ streetsidesoftware.code-spell-checker-russian
+ streetsidesoftware.code-spell-checker-scientific-terms
+ tamasfe.even-better-toml
+ task.vscode-task
+ vscode-org-mode.org-mode
+ ziglang.vscode-zig
+ ]
+ ++ optional cfg.vim.enable vscodevim.vim;
+
+ userSettings = {
+ editor = {
+ codeLens = false;
+ cursorStyle = "block";
+ detectIndentation = true;
+ minimap.enabled = false;
+ renderWhitespace = "trailing";
+ rulers = [
+ 80
+ 120
+ ];
+ smoothScrolling = false;
+ tabCompletion = "on";
+ cursorSurroundingLines = 10;
+ scrollBeyondLastColumn = 10;
+ };
+
+ keyboard.dispatch = "keyCode";
+
+ diffEditor.codeLens = false;
+
+ files = {
+ autoSave = "off";
+ enableTrash = false;
+ };
+
+ workbench = {
+ activityBar.location = "hidden";
+ colorTheme = "Default Light Modern";
+ editor.highlightModifiedTabs = true;
+ enableExperiments = false;
+ settings.enableNaturalLanguageSearch = false;
+ startupEditor = "none";
+ tips.enabled = false;
+ tree.indent = 4;
+ welcomePage = {
+ walkthroughs.openOnInstall = false;
+ preferReducedMotion = true;
+ };
+ };
+
+ extensions = {
+ autoCheckUpdates = false;
+ autoUpdate = false;
+ ignoreRecommendations = true;
+ };
+
+ terminal.integrated = {
+ enableBell = true;
+ };
+
+ update = {
+ mode = "none";
+ showReleaseNotes = false;
+ };
+
+ telemetry = {
+ enableCrashReporter = false;
+ enableTelemetry = false;
+ };
+
+ security.workspace.trust.enabled = false;
+
+ # Extensions.
+
+ ansible = {
+ ansible = {
+ useFullyQualifiedCollectionNames = true;
+ reuseTerminal = true;
+ };
+ validation.lint.path = getExe' pkgs.ansible-lint "ansible-lint";
+ };
+
+ bashIde.shellcheckPath = getExe' pkgs.shellcheck "shellcheck";
+
+ cSpell.language = "en-GB,en,ru";
+
+ direnv = {
+ restart.automatic = true;
+ };
+
+ magit = {
+ forge-enabled = true;
+ git-path = getExe config.hm.programs.git.package;
+ };
+
+ git.openRepositoryInParentFolders = "always";
+
+ github = {
+ branchProtection = true;
+ gitProtocol = "ssh";
+ };
+
+ terraform = {
+ languageServer.path = getExe' pkgs.terraform-ls "terraform-ls";
+ languageServer.terraform.path = getExe pkgs.opentofu;
+ };
+
+ haskell = {
+ formattingProvider = "ormolu";
+ serverExecutablePath = getExe' pkgs.haskell-language-server "haskell-language-server";
+ };
+
+ nix = {
+ enableLanguageServer = true;
+ serverPath = getExe pkgs.nil;
+ };
+
+ python = with pkgs.python311Packages; {
+ experiments.optOutFrom = [ "All" ];
+ pipenvPath = getExe' pkgs.pipenv "pipenv";
+ poetryPath = getExe' pkgs.poetry "poetry";
+ formatting = {
+ provider = "black";
+ autopep8Path = getExe' autopep8 "autopep8";
+ blackPath = getExe' black "black";
+ yapfPath = getExe' yapf "yapf";
+ };
+ linting = {
+ enabled = true;
+ banditPath = getExe' bandit "bandit";
+ flake8Path = getExe' flake8 "flake8";
+ mypyPath = getExe' mypy "mypy";
+ pycodestylePath = getExe' pycodestyle "pycodestyle";
+ pydocstylePath = getExe' pydocstyle "pydocstyle";
+ pylamaPath = getExe' pylama "pylama";
+ pylintPath = getExe' pylint "pylint";
+ };
+ testing = {
+ pytestPath = getExe' pytest "pytest";
+ };
+ };
+
+ rust-client = {
+ disableRustup = true;
+ rustupPath = getExe' pkgs.rustup "rustup";
+ rustfmt_path = getExe pkgs.rustfmt;
+ };
+
+ vim = mkIf cfg.vim.enable {
+ easymotion = true;
+
+ leader = " ";
+
+ useSystemClipboard = true;
+ };
+
+ zig.zls = {
+ checkForUpdate = false;
+ path = getExe' pkgs.zls "zls";
+ };
+
+ redhat.telemetry.enabled = false;
+ };
+ };
+ };
+
+ nixpkgs.overlays = [ inputs.vscode-extensions.overlays.default ];
+ };
+}