From 0ee492277a21ccf1e65703c1edea9a6f43eb1529 Mon Sep 17 00:00:00 2001 From: cswimr Date: Tue, 19 Nov 2024 22:17:36 -0500 Subject: [PATCH] configure `vscode` to install all of my extensions and settings declaratively instead of using settings sync --- flake.lock | 126 +++++++++++++- flake.nix | 48 ++++-- home-manager/cswimr.nix | 2 +- home-manager/vscode.nix | 363 ++++++++++++++++++++++++++++++++++++++++ nixos/configuration.nix | 3 - 5 files changed, 522 insertions(+), 20 deletions(-) create mode 100644 home-manager/vscode.nix diff --git a/flake.lock b/flake.lock index 11b57df..c7ef760 100644 --- a/flake.lock +++ b/flake.lock @@ -15,6 +15,23 @@ "type": "github" } }, + "catppuccin-vsc": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1731106889, + "narHash": "sha256-acq5Rbg2swreKyZDswqd9c9X1NtTNexMkKZNws/l4s8=", + "rev": "39e26a0e1bd5a84899c2b786b9119d6e9174297f", + "revCount": 523, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/catppuccin/vscode/3.16.0/01931044-41cd-79d3-882f-dd68e6ebfa38/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/catppuccin/vscode/%2A.tar.gz" + } + }, "compose2nix": { "inputs": { "nixpkgs": [ @@ -36,6 +53,22 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1652776076, @@ -51,6 +84,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -95,7 +146,59 @@ "type": "github" } }, + "nix-vscode-extensions": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1731981189, + "narHash": "sha256-EnDFNJq3CuPLZ+3BxGDAqIckbK5pBkUFt3nqLafni4o=", + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "rev": "6f1845dd71ddeb7463856750c5e0cb6c122bb87a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1712963716, + "narHash": "sha256-WKm9CvgCldeIVvRz87iOMi8CFVB1apJlkUT4GGvA0iM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cfd6b5fc90b15709b780a5a1619695a88505a176", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1713805509, + "narHash": "sha256-YgSEan4CcrjivCNO5ZNzhg7/8ViLkZ4CB/GrGBVSudo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1e1dc66fe68972a76679644a5577828b6a7e8be4", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1731319897, "narHash": "sha256-PbABj4tnbWFMfBp6OcUK5iGy1QY+/Z96ZcLpooIbuEI=", @@ -111,7 +214,7 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs_4": { "locked": { "lastModified": 1731676054, "narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=", @@ -152,15 +255,32 @@ "root": { "inputs": { "catppuccin": "catppuccin", + "catppuccin-vsc": "catppuccin-vsc", "compose2nix": "compose2nix", "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "nix-vscode-extensions": "nix-vscode-extensions", + "nixpkgs": "nixpkgs_3", "zen-browser": "zen-browser" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "zen-browser": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1731689384, diff --git a/flake.nix b/flake.nix index 56f21ae..df9f62d 100644 --- a/flake.nix +++ b/flake.nix @@ -12,13 +12,26 @@ inputs.nixpkgs.follows = "nixpkgs"; }; zen-browser.url = "github:0xc000022070/zen-browser-flake"; + nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; + catppuccin-vsc.url = "https://flakehub.com/f/catppuccin/vscode/*.tar.gz"; }; outputs = { nixpkgs, home-manager, catppuccin, ... }@inputs: - let system = "x86_64-linux"; + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + overlays = [ inputs.catppuccin-vsc.overlays.default ]; + config.allowUnfree = true; + }; in { nixosConfigurations = { eclipse = nixpkgs.lib.nixosSystem { system = system; + specialArgs = { + inherit inputs; + inherit pkgs; + system = system; + }; modules = [ # imports ./hosts/eclipse.nix @@ -62,18 +75,27 @@ # Home Manager home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.cswimr = { - imports = [ - ./home-manager/cswimr.nix - catppuccin.homeManagerModules.catppuccin - { - catppuccin.enable = true; - catppuccin.flavor = "mocha"; - catppuccin.accent = "blue"; - } - ]; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "bak"; + extraSpecialArgs = { + inherit inputs; + inherit pkgs; + system = system; + }; + users.cswimr = { + imports = [ + ./home-manager/cswimr.nix + ./home-manager/vscode.nix + catppuccin.homeManagerModules.catppuccin + { + catppuccin.enable = true; + catppuccin.flavor = "mocha"; + catppuccin.accent = "blue"; + } + ]; + }; }; } ]; diff --git a/home-manager/cswimr.nix b/home-manager/cswimr.nix index 2c81a29..d218ff1 100755 --- a/home-manager/cswimr.nix +++ b/home-manager/cswimr.nix @@ -30,7 +30,7 @@ }; # Packages that should be installed to the user profile. - home.packages = with pkgs; [ vesktop vscode ]; + home.packages = with pkgs; [ vesktop ]; # basic configuration of git, please change to your own programs.git = { diff --git a/home-manager/vscode.nix b/home-manager/vscode.nix new file mode 100644 index 0000000..bc4b753 --- /dev/null +++ b/home-manager/vscode.nix @@ -0,0 +1,363 @@ +{ pkgs, system, inputs, ... }: { + programs.vscode = { + enable = true; + #package = pkgs.vscode.fhsWithPackages (ps: [ ]); + extensions = + with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace; + with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace-release; [ + # Themes + (pkgs.catppuccin-vsc.override { + accent = "blue"; + extraBordersEnabled = true; + italicKeywords = false; + customUIColors = { + mocha = { "statusBar.foreground" = "accent"; }; + macchiato = { "statusBar.foreground" = "accent"; }; + frappe = { "statusBar.foreground" = "accent"; }; + latte = { "statusBar.foreground" = "accent"; }; + }; + }) + catppuccin.catppuccin-vsc-icons + + # C# + ms-dotnettools.csharp + ms-dotnettools.csdevkit + ms-dotnettools.vscodeintellicode-csharp + ms-dotnettools.vscode-dotnet-runtime + csharpier.csharpier-vscode + patcx.vscode-nuget-gallery + + # Python + ms-python.python + ms-python.vscode-pylance + ms-python.debugpy + ms-python.black-formatter + ms-python.isort + ms-python.flake8 + charliermarsh.ruff + matangover.mypy + + # JavaScript / TypeScript + dbaeumer.vscode-eslint + yoavbls.pretty-ts-errors + quick-lint.quick-lint-js + gregorbiswanger.json2ts + vendicated.vencord-companion + + # Luau + evaera.vscode-rojo + undermywheel.roblox-lua + johnnymorganz.stylua + johnnymorganz.luau-lsp + nightrains.robloxlsp + + # Go + golang.go + + # Kotlin + mathiasfrohlich.kotlin + + # Java + vscjava.vscode-java-debug + vscjava.vscode-gradle + vscjava.vscode-maven + vscjava.vscode-java-dependency + vscjava.vscode-java-test + redhat.java + + # Bash + mads-hartmann.bash-ide-vscode + foxundermoon.shell-format + timonwong.shellcheck + shakram02.bash-beautify + + # Paradox Interactive Scripting + tboby.cwtools-vscode + + # Git + donjayamanne.githistory + codezombiech.gitignore + eamodio.gitlens + + # GitHub + ziyasal.vscode-open-in-github + pkgs.vscode-extensions.github.vscode-github-actions + github.vscode-pull-request-github + + # Misc - Language Support + jnoortheen.nix-ide + tamasfe.even-better-toml + matthewpi.caddyfile-support + editorconfig.editorconfig + prisma.prisma + redhat.vscode-yaml + ms-vscode.powershell + irongeek.vscode-env + wholroyd.jinja + ms-vscode.makefile-tools + tnze.snbt + logerfo.sln-support + tboby.paradox-syntax + xteal.mcmeta + footerman.heracles-support + + # Misc - Debuggers + firefox-devtools.vscode-firefox-debug + rogalmic.zsh-debug + + # Misc - Linters + tekumara.typos-vscode + stylelint.vscode-stylelint + + # Misc - Formatters + esbenp.prettier-vscode + + # Misc - Visuals + naumovs.color-highlight + kshetline.ligatures-limited + + # Misc - Utilities + adpyke.codesnap + exodiusstudios.comment-anchors + elypia.magick-image-reader + adpyke.vscode-sql-formatter + qwtel.sqlite-viewer + yy0931.vscode-sqlite3-editor + supermaven.supermaven # requires a supermaven subscription - https://supermaven.com/ + leonardssh.vscord + alefragnani.project-manager + mkhl.direnv + ms-vsliveshare.vsliveshare + ms-azuretools.vscode-docker + ms-vscode-remote.remote-ssh + pkgs.vscode-extensions.ms-vscode-remote.remote-ssh-edit + ms-vscode.remote-server + ms-vscode.remote-explorer + pkgs.vscode-extensions.ms-vscode-remote.remote-containers + ms-vscode.remote-repositories + formulahendry.auto-rename-tag + prunoideae.probejs + d-koppenhagen.file-tree-to-text-generator + ]; + userSettings = { + "editor.tokenColorCustomizations" = { + "[Catppuccin*]" = { + "variables" = "#82eaf0"; + "textMateRules" = [ + { + "scope" = "comment"; + "settings" = { + "foreground" = "#f465ec"; + "fontStyle" = "italic"; + }; + } + { + "scope" = "punctuation.definition.comment"; + "settings" = { + "foreground" = "#f465ec"; + "fontStyle" = "italic"; + }; + } + { + "scope" = "variable.other.readwrite"; + "settings" = { "foreground" = "#82eaf0"; }; + } + { + "scope" = "keyword.operator"; + "settings" = { "foreground" = "#EBA0AC"; }; + } + { + "scope" = "meta.block.paradox"; + "settings" = { "foreground" = "#EBA0AC"; }; + } + { + "scope" = "meta.shebang.shell"; + "settings" = { + "foreground" = "#fb5d1f"; + "fontStyle" = "italic bold"; + }; + } + { + "scope" = "punctuation.definition.comment.shebang.shell"; + "settings" = { + "foreground" = "#fb5d1f"; + "fontStyle" = "italic bold"; + }; + } + { + "scope" = + "string.quoted.double.shell variable.other.normal.shell"; + "settings" = { "foreground" = "#82e5f0"; }; + } + { + "scope" = "variable.other.property.ts"; + "settings" = { "foreground" = "#32d5e7"; }; + } + ]; + }; + }; + "[python]" = { + "editor.formatOnType" = true; + "editor.formatOnSave" = true; + "editor.defaultFormatter" = "charliermarsh.ruff"; + "editor.codeActionsOnSave" = { + "source.fixAll" = "explicit"; + "source.organizeImports" = "explicit"; + }; + }; + "python.terminal.activateEnvironment" = false; + "python.terminal.activateEnvInCurrentTerminal" = false; + "[csharp]" = { + "editor.defaultFormatter" = "csharpier.csharpier-vscode"; + "editor.formatOnSave" = true; + "editor.formatOnSaveMode" = "file"; + }; + "[typescript]" = { + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + "editor.formatOnType" = false; + "editor.formatOnPaste" = true; + "editor.formatOnSave" = true; + "editor.formatOnSaveMode" = "file"; + "files.autoSave" = "onFocusChange"; + }; + "[markdown]" = { "files.trimTrailingWhitespace" = false; }; + "yaml.schemas" = { + "https://json.schemastore.org/github-workflow.json" = [ + ".github/workflows/*.{yml,yaml}" + ".forgejo/workflows/*.{yml,yaml}" + ".gitea/workflows/*.{yml,yaml}" + ]; + }; + "yaml.schemaStore.enable" = true; + "nix.enableLanguageServer" = true; + "nix.serverSettings" = { + "nil" = { "formatting" = { "command" = [ "nixfmt" ]; }; }; + }; + "nix.serverPath" = "nil"; + "vscord.status.image.large.debugging.key" = + "https://vscord.catppuccin.com/mocha/debugging.webp"; + "vscord.status.image.large.editing.key" = + "https://vscord.catppuccin.com/mocha/{lang}.webp"; + "vscord.status.image.large.idle.key" = + "https://vscord.catppuccin.com/mocha/idle-{app_id}.webp"; + "vscord.status.image.large.notInFile.key" = + "https://vscord.catppuccin.com/mocha/idle-{app_id}.webp"; + "vscord.status.image.large.viewing.key" = + "https://vscord.catppuccin.com/mocha/{lang}.webp"; + "vscord.status.image.small.debugging.key" = + "https://vscord.catppuccin.com/mocha/debugging.webp"; + "vscord.status.image.small.editing.key" = + "https://vscord.catppuccin.com/mocha/{app_id}.webp"; + "vscord.status.image.small.idle.key" = + "https://vscord.catppuccin.com/mocha/idle.webp"; + "vscord.status.image.small.notInFile.key" = + "https://vscord.catppuccin.com/mocha/idle.webp"; + "vscord.status.image.small.viewing.key" = + "https://vscord.catppuccin.com/mocha/{app_id}.webp"; + "git.enableSmartCommit" = true; + "git.autofetch" = true; + "git.confirmSync" = false; + "security.workspace.trust.untrustedFiles" = "open"; + "files.insertFinalNewline" = true; + "files.trimFinalNewlines" = true; + "files.trimTrailingWhitespace" = true; + "editor.inlineSuggest.enabled" = true; + "diffEditor.ignoreTrimWhitespace" = false; + "git.enableCommitSigning" = true; + "editor.accessibilitySupport" = "off"; + "git.inputValidationSubjectLength" = null; + "git.inputValidationLength" = 150; + "editor.fontLigatures" = + "'cv01', 'cv02', 'ss05', 'ss08', 'ss03', 'cv29', 'cv30', 'cv11'"; + "workbench.iconTheme" = "catppuccin-latte"; + "codesnap.shutterAction" = "copy"; + "codesnap.transparentBackground" = true; + "codesnap.realLineNumbers" = true; + "codesnap.roundedCorners" = true; + "codesnap.showWindowTitle" = true; + "codesnap.showWindowControls" = false; + "gitlens.remotes" = [{ + "domain" = "www.coastalcommits.com"; + "type" = "Gitea"; + }]; + "markdownlint.config" = { + "ol-prefix" = false; + "html" = false; + }; + "markdownlint.lintWorkspaceGlobs" = [ + "**/*.{md,mkd,mdwn,mdown,markdown,markdn,mdtxt,mdtext,workbook}" + "!**/node_modules" + "!**/bower_components" + "!**/.git" + "!**/LICENSE" + "!**/LICENSE.md" + ]; + "editor.largeFileOptimizations" = false; + "files.associations" = { + ".env" = "properties"; + "*.ini" = "paradox"; + "*.kt" = "kotlin"; + }; + "editor.semanticHighlighting.enabled" = true; + "[css]" = { "editor.defaultFormatter" = "vscode.css-language-features"; }; + "git.ignoreRebaseWarning" = true; + "remote.autoForwardPortsSource" = "hybrid"; + "git.replaceTagsWhenPull" = true; + "redhat.telemetry.enabled" = true; + "editor.fontSize" = 14; + "workbench.colorTheme" = "Catppuccin Mocha"; + "editor.codeLensFontFamily" = + "'ComicCodeLigatures Nerd Font', 'Comic Code Ligatures', 'FiraCode Nerd Font'"; + "editor.inlayHints.fontFamily" = + "'ComicCodeLigatures Nerd Font', 'Comic Code Ligatures', 'FiraCode Nerd Font', 'FiraCode Nerd Font Light'"; + "editor.fontFamily" = + "'ComicCodeLigatures Nerd Font', 'Comic Code Ligatures', 'FiraCode Nerd Font'"; + "explorer.confirmDelete" = false; + "window.confirmSaveUntitledWorkspace" = false; + "cwtools.cache.stellaris" = "/bulk/steam/steamapps/common/Stellaris"; + "python.analysis.inlayHints.callArgumentNames" = "partial"; + "python.analysis.inlayHints.functionReturnTypes" = true; + "explorer.confirmDragAndDrop" = false; + "editor.unicodeHighlight.allowedLocales" = { ru = true; }; + "terminal.integrated.defaultProfile.linux" = "zsh"; + "explorer.confirmPasteNative" = false; + "editor.renderWhitespace" = "none"; + "explorer.fileNesting.patterns" = { + "*.ts" = "\${capture}.js"; + "*.js" = "\${capture}.js.map, \${capture}.min.js, \${capture}.d.ts"; + "*.jsx" = "\${capture}.js"; + "*.tsx" = "\${capture}.ts"; + "tsconfig.json" = "tsconfig.*.json"; + "package.json" = + "package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb"; + "Cargo.toml" = "Cargo.lock"; + "*.sqlite" = "\${capture}.\${extname}-*"; + "*.db" = "\${capture}.\${extname}-*"; + "*.sqlite3" = "\${capture}.\${extname}-*"; + "*.db3" = "\${capture}.\${extname}-*"; + "*.sdb" = "\${capture}.\${extname}-*"; + "*.s3db" = "\${capture}.\${extname}-*"; + }; + "[shellscript]" = { + "editor.defaultFormatter" = "shakram02.bash-beautify"; + }; + "vscord.app.name" = "Visual Studio Code"; + "workbench.editorAssociations" = { "*.db" = "sqlite3-editor.editor"; }; + "vs-code-prettier-eslint.prettierLast" = false; + "typescript.updateImportsOnFileMove.enabled" = "always"; + "supermaven.allowGitignore" = true; + "[javascript]" = { + "editor.defaultFormatter" = "esbenp.prettier-vscode"; + }; + "[json]" = { + "editor.defaultFormatter" = "vscode.json-language-features"; + }; + "go.toolsManagement.autoUpdate" = true; + "remote.SSH.remotePlatform" = { "eclipse" = "linux"; }; + "terminal.integrated.fontWeightBold" = "bold"; + "terminal.integrated.fontFamily" = + "'ComicCodeLigatures Nerd Font', 'Comic Code Ligatures', 'FiraCode Nerd Font'"; + "[jsonc]" = { "editor.defaultFormatter" = "esbenp.prettier-vscode"; }; + }; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 502d615..ca6736f 100755 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -103,9 +103,6 @@ # We disable this because we're using zen-browser in the flake.nix programs.firefox.enable = false; - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true;