From 360acefef9635d07a40385dfe58841bbaf7fbe4e Mon Sep 17 00:00:00 2001 From: Lucy Hochkamp Date: Wed, 11 Oct 2023 17:10:04 +0200 Subject: [PATCH] more vscode --- flake.lock | 90 ++++++++++++++++++++++++++++++- flake.nix | 4 ++ hm-imports/vscode/default.nix | 99 ++++++++++++++++++++++++++++++++++- 3 files changed, 190 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index f42a6c4e..7e23a193 100644 --- a/flake.lock +++ b/flake.lock @@ -118,6 +118,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -215,6 +231,24 @@ "type": "github" } }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "haskell-flake": { "locked": { "lastModified": 1684780604, @@ -433,6 +467,26 @@ "type": "github" } }, + "nix-vscode-extensions": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1696987176, + "narHash": "sha256-JdfrQAZD4LVQSQ1UV4d6O+8582aJxcenTTR2QW1mwUw=", + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "rev": "be62771c733f226651149c8a07c40c7c52c5ff5a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-vscode-extensions", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1696161939, @@ -532,6 +586,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1684570954, + "narHash": "sha256-FX5y4Sm87RWwfu9PI71XFvuRpZLowh00FQpIJ1WfXqE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3005f20ce0aaa58169cdee57c8aa12e5f1b6e1b3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1696323343, "narHash": "sha256-u7WLUrh5eb+6SBYwtkaGL2ryHpLcHzmLml+a+VqKJWE=", @@ -698,8 +768,9 @@ "lolpizza": "lolpizza", "miro": "miro", "neovim-nightly-overlay": "neovim-nightly-overlay", + "nix-vscode-extensions": "nix-vscode-extensions", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-master": "nixpkgs-master", "nnn-nvim": "nnn-nvim", @@ -779,6 +850,21 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1656928814, @@ -796,7 +882,7 @@ }, "utils_2": { "inputs": { - "systems": "systems_3" + "systems": "systems_4" }, "locked": { "lastModified": 1694529238, diff --git a/flake.nix b/flake.nix index 5860f007..5f678e0a 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,7 @@ neovim-nightly-overlay.inputs.neovim-flake.url = "github:neovim/neovim?dir=contrib&rev=eb151a9730f0000ff46e0b3467e29bb9f02ae362"; neovim-nightly-overlay.inputs.neovim-flake.inputs.nixpkgs.follows = "nixpkgs-master"; + # programs xynoblog.url = "github:thexyno/blog"; xynoblog.inputs.nixpkgs.follows = "nixpkgs"; @@ -43,6 +44,9 @@ noice-nvim.url = "github:folke/noice.nvim"; noice-nvim.flake = false; + ## vscode + nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions"; + ## zsh zsh-completions.url = "github:zsh-users/zsh-completions"; zsh-completions.flake = false; diff --git a/hm-imports/vscode/default.nix b/hm-imports/vscode/default.nix index 59699be8..971fa281 100644 --- a/hm-imports/vscode/default.nix +++ b/hm-imports/vscode/default.nix @@ -1,17 +1,114 @@ -{ pkgs, config, lib, ... }: +{ pkgs, config, lib, inputs, ... }: let cfg = config.ragon.vscode; + exts = inputs.nix-vscode-extensions.extensions.${pkgs.system}; + in { options.ragon.vscode.enable = lib.mkOption { default = false; }; config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + nil + nixpkgs-fmt + ]; programs.vscode = { enable = true; extensions = with pkgs.vscode-extensions; [ vscodevim.vim # vim mode (hopefully good) yzhang.markdown-all-in-one # markdown jdinhlife.gruvbox # theme + mkhl.direnv # direnv + + + # Language Support + jnoortheen.nix-ide # nix + golang.go # go + ms-pyright.pyright # python + ms-dotnettools.csharp # c# und so + rust-lang.rust-analyzer # rust + + ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ + { + # swift lsp (official apple somehow) + name = "swift-lang"; + publisher = "sswg"; + version = "1.6.1"; + sha256 = "sha256-4/Hb8hgQb8osVqjH6qZgaPC0XcY1YaIxcobhHLGGuxQ="; + } ]; + userSettings = + let + fontFamily = "'JetBrainsMono Nerd Font', monospace"; + in + { + "editor.fontFamily" = fontFamily; + "terminal.integrated.fontFamily" = fontFamily; + "workbench.colorTheme" = "Gruvbox Dark Soft"; + "editor.autoClosingBrackets" = "never"; + "editor.autoClosingQuotes" = "never"; + "editor.minimap.autohide" = true; + + # Addon Configuration + + ## Vim + "vim.leader" = ""; + "vim.normalModeKeyBindings" = [ + { before = [ "" ]; after = [ "" "h" ]; } + { before = [ "" ]; after = [ "" "j" ]; } + { before = [ "" ]; after = [ "" "k" ]; } + { before = [ "" ]; after = [ "" "l" ]; } + ]; + "vim.normalModeKeyBindingsNonRecursive" = [ + { + before = [ "" "s" ]; + "commands" = [ "workbench.action.splitEditor" ]; + quiet = true; + } + { + before = [ "" "a" "s" ]; + "commands" = [ "workbench.action.splitEditorDown" ]; + quiet = true; + } + { + before = [ "" "q" ]; + "commands" = [ "workbench.action.closeActiveEditor" ]; + quiet = true; + } + { + before = [ "" "f" ]; + "commands" = [ "editor.action.formatDocument" ]; + quiet = true; + } + { + before = [ "]" "g" ]; + "commands" = [ "editor.action.marker.next" ]; + quiet = true; + } + { + before = [ "[" "g" ]; + "commands" = [ "editor.action.marker.prev" ]; + quiet = true; + } + { + before = [ "" ]; + "commands" = [ "workbench.view.explorer" ]; + quiet = true; + } + { + before = [ "" ]; + "commands" = [ "workbench.action.closeSidebar" ]; + quiet = true; + } + { + before = [ "" "t" ]; + "commands" = [ "terminal.focus" ]; + quiet = true; + } + ]; + ## Nix + "nix.serverPath" = "nil"; + "nix.enableLanguageServer" = true; + }; }; }; }