123 lines
		
	
	
	
		
			4.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			123 lines
		
	
	
	
		
			4.5 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  pkgs,
 | 
						|
  lib,
 | 
						|
  inputs,
 | 
						|
  config,
 | 
						|
  system,
 | 
						|
  ...
 | 
						|
}:
 | 
						|
{
 | 
						|
  programs.vscode = {
 | 
						|
    enable = true;
 | 
						|
    package = pkgs.vscodium;
 | 
						|
    mutableExtensionsDir = true;
 | 
						|
    profiles.default = {
 | 
						|
      extensions =
 | 
						|
        with pkgs.vscode-extensions;
 | 
						|
        [
 | 
						|
          ms-python.python
 | 
						|
          charliermarsh.ruff
 | 
						|
          vscodevim.vim
 | 
						|
          yzhang.markdown-all-in-one
 | 
						|
          tamasfe.even-better-toml
 | 
						|
          eamodio.gitlens
 | 
						|
          jnoortheen.nix-ide
 | 
						|
          mkhl.direnv
 | 
						|
          editorconfig.editorconfig
 | 
						|
        ]
 | 
						|
        ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
 | 
						|
          {
 | 
						|
            name = "sync-rsync-extended";
 | 
						|
            publisher = "SanderVerschoor";
 | 
						|
            version = "1.0.1";
 | 
						|
            sha256 = "sha256-Jsfa1SrK1H0QwlJPEBdrb0gfGiIYoXdtIP32/4g+ceM=";
 | 
						|
          }
 | 
						|
          # TODO: probably available in nixpkgs soonish?
 | 
						|
          {
 | 
						|
            name = "mypy-type-checker";
 | 
						|
            publisher = "ms-python";
 | 
						|
            version = "2023.3.12681020";
 | 
						|
            sha256 = "sha256-rhed7CQlvxksVCGc9nPU2oYQWtXcAV5TzuG63e8Y3zM=";
 | 
						|
          }
 | 
						|
          {
 | 
						|
            name = "vscode-pets";
 | 
						|
            publisher = "tonybaloney";
 | 
						|
            version = "1.25.1";
 | 
						|
            sha256 = "sha256-as3e2LzKBSsiGs/UGIZ06XqbLh37irDUaCzslqITEJQ=";
 | 
						|
          }
 | 
						|
        ];
 | 
						|
      userSettings =
 | 
						|
        let
 | 
						|
          defaultPython = pkgs.python3.withPackages (ps: [
 | 
						|
            ps.jedi
 | 
						|
            ps.jedi-language-server
 | 
						|
            ps.pip
 | 
						|
            ps.setuptools # for pkg_resources
 | 
						|
            ps.black
 | 
						|
            ps.mypy
 | 
						|
          ]);
 | 
						|
        in
 | 
						|
        {
 | 
						|
          "telemetry.enableTelemetry" = false;  # might not be needed for Codium
 | 
						|
          "editor.fontLigatures" = true;
 | 
						|
          "editor.accessibilitySupport" = false; # prevent asking
 | 
						|
          "editor.cursorBlinking" = "phase";
 | 
						|
          "editor.stickyScroll.enabled" = true;
 | 
						|
          "workbench.editor.highlightModifiedTabs" = true;
 | 
						|
          "window.autoDetectColorScheme" = true;
 | 
						|
          "workbench.preferredDarkColorTheme" = "Default Dark Modern";
 | 
						|
          "workbench.preferredLightColorTheme" = "Default Light Modern";
 | 
						|
          "[nix]" = {
 | 
						|
            "editor.insertSpaces" = true;
 | 
						|
            "editor.tabSize" = 2;
 | 
						|
            # for now, disable automatic formatting to prevent disruption of existing code bases
 | 
						|
            "editor.formatOnPaste" = false;
 | 
						|
            "editor.formatOnSave" = false;
 | 
						|
            "editor.formatOnType" = false;
 | 
						|
          };
 | 
						|
          "nix.formatterPath" = lib.getExe pkgs.nixfmt-rfc-style;
 | 
						|
          "nix.enableLanguageServer" = true;
 | 
						|
          "nix.serverPath" = lib.getExe pkgs.nixd;
 | 
						|
          "nix.serverSettings" = { };
 | 
						|
          "editor.fontSize" = 13;
 | 
						|
          "editor.fontWeight" = "normal";
 | 
						|
          "git.detectSubmodulesLimit" = 30;
 | 
						|
          "[python]" = {
 | 
						|
            "breadcrumbs.showClasses" = true;
 | 
						|
            "breadcrumbs.showFunctions" = true;
 | 
						|
            "gitlens.codeLens.symbolScopes" = [ "!Module" ];
 | 
						|
            "editor.defaultFormatter" = "charliermarsh.ruff";
 | 
						|
            "editor.formatOnSave" = true;
 | 
						|
            # workaround for jedi-language-server < 0.45.1, semantic tokens are still broken
 | 
						|
            "editor.semanticHighlighting.enabled" = false;
 | 
						|
          };
 | 
						|
          "python.experiments.enabled" = false;
 | 
						|
          "python.languageServer" = "Jedi"; # don't use proprietary pylance server
 | 
						|
          "python.defaultInterpreterPath" = lib.getExe defaultPython;
 | 
						|
          "mypy-type-checker.path" = [ "${pkgs.python3Packages.mypy}/bin/dmypy" ];
 | 
						|
          "mypy-type-checker.preferDaemon" = true;
 | 
						|
          "mypy-type-checker.importStrategy" = "fromEnvironment";
 | 
						|
          "mypy-type-checker.args" = [ "--ignore-missing-imports" ];
 | 
						|
          "ruff.path" = [ (lib.getExe pkgs.ruff) ];
 | 
						|
          "gitlens.telemetry.enabled" = false;
 | 
						|
          "vim.highlightedyank.enable" = true;
 | 
						|
          "vim.history" = 500;
 | 
						|
          "vim.neovimUseConfigFile" = true;
 | 
						|
          "vim.enableNeovim" = true;
 | 
						|
          "git.suggestSmartCommit" = false;
 | 
						|
          "editor.rulers" = [ 79 ];
 | 
						|
          "vim.useSystemClipboard" = true;
 | 
						|
          "vim.smartRelativeLine" = true;
 | 
						|
          "diffEditor.ignoreTrimWhitespace" = false;
 | 
						|
          "files.associations" = {
 | 
						|
            "*.py" = "python";
 | 
						|
          };
 | 
						|
          "editor.renderWhitespace" = "all";
 | 
						|
          "editor.fontFamily" = "Iosevka Curly Slab, Menlo, Monaco, 'Courier New', monospace";
 | 
						|
          "vim.neovimPath" = lib.getExe pkgs.myVim;
 | 
						|
          "sync-rsync.options" = [ ];
 | 
						|
          "direnv.path.executable" = lib.getExe pkgs.direnv;
 | 
						|
        };
 | 
						|
    };
 | 
						|
  };
 | 
						|
}
 |