diff --git a/homes/me/default.nix b/homes/me/default.nix index 46b2de6..ac87870 100755 --- a/homes/me/default.nix +++ b/homes/me/default.nix @@ -6,13 +6,13 @@ pkgs, pkgs-unstable, ... -}: { +} @ args: { imports = [ ../modules/git.nix ../modules/bat.nix ../modules/fish.nix ../modules/editor/helix.nix - ../modules/editor/vscodium.nix + (import ../modules/editor/vscode.nix args) ../modules/btop.nix ../modules/term/foot.nix @@ -25,6 +25,11 @@ ../modules/mako.nix ]; + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.GetName pkg) [ + "vscode-extension-ms-dotnettools-csharp" + ]; + home = { username = "me"; homeDirectory = "/home/me"; diff --git a/homes/modules/editor/vscode.nix b/homes/modules/editor/vscode.nix new file mode 100644 index 0000000..f824b1c --- /dev/null +++ b/homes/modules/editor/vscode.nix @@ -0,0 +1,134 @@ +{ + config, + lib, + pkgs, + vscodium ? false, + secret-service ? "gnome-libsecret", + vscode-argv ? ".vscode/argv.json", + ... +}: { + nixpkgs.overlays = [ + ( + self: super: { + vscode-extensions = super.vscode-extensions.overrideAttrs (prev: let + mkVscMarketplaceExtension = { + publisher, + name, + version, + hash, + description ? "", + homepage ? null, + changelog ? null, + license ? null, + maintainers ? [lib.maintainers.emileclarkb], + }: + with pkgs.vscode-utils.buildVscodeMarketplaceExtension; { + ${publisher}.${name} = buildVscodeMarketplaceExtension { + mktplcRef = { + inherit + publisher + name + version + hash + ; + }; + + meta = { + inherit + ( + if license != null + then {license = license;} + else {} + ) + description + homepage + maintainers + ; + downloadPage = "https://marketplace.visualstudio.com/items?itemName=${publisher}.${name}"; + changelog = + if changelog != null + then changelog + else "https://marketplace.visualstudio.com/items/${publisher}.${name}/changelog"; + }; + }; + }; + in + lib.mergeAttrsList [ + (mkVscMarketplaceExtension { + publisher = "ms-dotnettools"; + name = "dotnet-maui"; + version = "1.11.14"; + hash = lib.fakeHash; + + description = "Extend C# Dev Kit with tools for building .NET Multi-platform App UI (MAUI) apps"; + homepage = "https://github.com/microsoft/vscode-dotnettools"; + license = lib.licenses.unfree; + }) + ]); + } + ) + ]; + + # REF: https://home-manager-options.extranix.com/?query=vscode&release=release-25.05 + programs.vscode = { + enable = true; + # TODO: clean up + package = + ( + if vscodium + then pkgs.vscodium + else pkgs.vscode + ).overrideAttrs (oldAttrs: { + # runtimeDependencies = oldAttrs.runtimeDependencies ++ [] + }); + + mutableExtensionsDir = true; + + profiles.default = { + enableUpdateCheck = false; + enableExtensionUpdateCheck = false; + # extension format: USER.PACKAGENAME + extensions = with pkgs.vscode-extensions; [ + # .NET + ms-dotnettools.csharp + ms-dotnettools.csdevkit + ms-dotnettools.vscode-dotnet-runtime + # TODO: these extensions aren't packaged :( + # deitry.solution-syntax + # ms-dotnettools.vscode-dotnet-pack + # ms-dotnettools.dotnet-maui + + # Python + ms-python.python + + # GitLens by GitKraken + eamodio.gitlens + ms-azuretools.vscode-docker + + github.copilot + github.copilot-chat + + # Colors & Themes + dracula-theme.theme-dracula + catppuccin.catppuccin-vsc + catppuccin.catppuccin-vsc-icons + mvllow.rose-pine + ]; + + userSettings = { + "workbench.colorTheme" = "Dracula Theme"; + "github.copilot.nextEditSuggestions.enabled" = true; + }; + }; + }; + + # TODO: this is super ugly, make sure the JSON is formatted!! + home.file.${vscode-argv}.text = builtins.toJSON { + password-store = secret-service; + + disable-hardware-acceleration = false; + disable-color-correct-rendering = false; + enable-crash-reporter = false; + # crash-report-id = ...; + }; +}