1
1
Fork 0

vscode: simplify module with overlay

Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
Myned 2025-03-08 12:43:16 -06:00
parent cbf01caae6
commit a7a6281669
Signed by: Myned
GPG key ID: C7224454F7881A34

View file

@ -7,12 +7,24 @@
}: }:
with lib; let with lib; let
cfg = config.custom.programs.vscode; cfg = config.custom.programs.vscode;
hm = config.home-manager.users.${config.custom.username};
in { in {
options.custom.programs.vscode.enable = mkOption {default = false;}; options.custom.programs.vscode = {
enable = mkOption {default = false;};
};
config = { config = {
# https://github.com/nix-community/nix-vscode-extensions
nixpkgs.overlays = [inputs.nix-vscode-extensions.overlays.default];
environment = {
sessionVariables = {
# https://github.com/nix-community/nixd/blob/main/nixd/docs/features.md
NIXD_FLAGS = "--inlay-hints=false"; # Disable package versions in the editor
};
# Extension dependencies # Extension dependencies
environment.systemPackages = with pkgs; [ systemPackages = with pkgs; [
alejandra # nix-ide alejandra # nix-ide
blueprint-compiler # blueprint-gtk blueprint-compiler # blueprint-gtk
caddy # caddyfile-support caddy # caddyfile-support
@ -20,8 +32,10 @@ in {
powershell # powershell powershell # powershell
shfmt # shell-format shfmt # shell-format
]; ];
};
home-manager.users.${config.custom.username} = mkIf cfg.enable { home-manager.sharedModules = mkIf cfg.enable [
{
# https://wiki.nixos.org/wiki/VSCodium # https://wiki.nixos.org/wiki/VSCodium
# https://github.com/VSCodium/vscodium # https://github.com/VSCodium/vscodium
#!! Configuration is imperative #!! Configuration is imperative
@ -31,17 +45,8 @@ in {
package = pkgs.vscodium; package = pkgs.vscodium;
profiles.default = { profiles.default = {
# https://github.com/nix-community/nix-vscode-extensions #?? nixos-rebuild repl > pkgs.REPO.*
#?? nixos-rebuild repl > inputs.nix-vscode-extensions.extensions.${pkgs.system}.* extensions = with pkgs.open-vsx;
extensions = let
# Use configured version of vscode
# https://github.com/nix-community/nix-vscode-extensions?tab=readme-ov-file#extensions
#?? extension = with (repo "REPOSITORY"); AUTHOR.EXTENSION
repo = repo:
with inputs.nix-vscode-extensions.extensions.${pkgs.system};
(forVSCodeVersion config.home-manager.users.${config.custom.username}.programs.vscode.package.version).${repo};
in
with (repo "open-vsx");
[ [
aaron-bond.better-comments aaron-bond.better-comments
antfu.iconify antfu.iconify
@ -76,7 +81,7 @@ in {
timonwong.shellcheck timonwong.shellcheck
vincaslt.highlight-matching-tag vincaslt.highlight-matching-tag
] ]
++ (with (repo "vscode-marketplace"); [ ++ (with pkgs.vscode-marketplace; [
#!! Some extensions go missing from open-vsx, so use official marketplace as fallback #!! Some extensions go missing from open-vsx, so use official marketplace as fallback
# https://github.com/nix-community/nix-vscode-extensions?tab=readme-ov-file#note # https://github.com/nix-community/nix-vscode-extensions?tab=readme-ov-file#note
bodil.blueprint-gtk bodil.blueprint-gtk
@ -87,7 +92,7 @@ in {
}; };
}; };
xdg.configFile = with config.home-manager.users.${config.custom.username}.lib.file; { xdg.configFile = with hm.lib.file; {
# Imperative symlinks intended to be synced # Imperative symlinks intended to be synced
"VSCodium/User/settings.json" = { "VSCodium/User/settings.json" = {
force = true; force = true;
@ -109,38 +114,7 @@ in {
source = mkOutOfStoreSymlink "${config.custom.sync}/dev/config/vscode/profiles/"; source = mkOutOfStoreSymlink "${config.custom.sync}/dev/config/vscode/profiles/";
}; };
}; };
}
home = { ];
# https://github.com/nix-community/nixd/blob/main/nixd/docs/features.md
sessionVariables.NIXD_FLAGS = "--inlay-hints=false"; # Disable package versions in the editor
# Work around wrong wmclass
# https://github.com/microsoft/vscode/issues/129953
# https://github.com/VSCodium/vscodium/issues/1414
#!! Keep updated with upstream desktop file
#?? cat /etc/profiles/per-user/USER/share/applications/codium.desktop
# file.".local/share/applications/codium.desktop".text = ''
# [Desktop Entry]
# Actions=new-empty-window
# Categories=Utility;TextEditor;Development;IDE
# Comment=Code Editing. Redefined.
# Exec=codium %F
# GenericName=Text Editor
# Icon=vscodium
# Keywords=vscode
# MimeType=text/plain;inode/directory
# Name=VSCodium
# StartupNotify=true
# StartupWMClass=codium-url-handler
# Type=Application
# Version=1.4
# [Desktop Action new-empty-window]
# Exec=codium --new-window %F
# Icon=vscodium
# Name=New Empty Window
# '';
};
};
}; };
} }