nixos-config/programs/editors/vscode/default.nix

101 lines
4.5 KiB
Nix
Raw Normal View History

2024-11-17 07:51:07 +00:00
{
vscode-server,
config,
systemConfig,
lib,
pkgs,
...
}:
2024-11-09 14:02:26 +00:00
{
2024-11-09 12:05:06 +00:00
imports = [
"${vscode-server}/modules/vscode-server/home.nix"
];
2024-11-09 12:02:10 +00:00
programs.vscode = {
enable = true;
enableExtensionUpdateCheck = false;
enableUpdateCheck = false;
mutableExtensionsDir = false;
2024-11-13 14:46:14 +00:00
extensions =
(with pkgs.vscode-extensions; [
fill-labs.dependi
jnoortheen.nix-ide
2024-11-13 16:03:01 +00:00
mechatroner.rainbow-csv
2024-11-13 14:46:14 +00:00
mkhl.direnv
pkief.material-icon-theme
rust-lang.rust-analyzer
signageos.signageos-vscode-sops
tamasfe.even-better-toml
vadimcn.vscode-lldb
])
++ (with pkgs.vscode-marketplace; [
2024-11-13 16:23:53 +00:00
janisdd.vscode-edit-csv
2024-11-13 14:46:14 +00:00
jscearcy.rust-doc-viewer
]);
2024-11-09 14:01:22 +00:00
userSettings = {
2024-11-09 19:41:56 +00:00
"editor.fontFamily" = "\"Fira Code\", \"Fira Code Nerd Font Mono\", monospace";
"editor.fontLigatures" = true;
2024-11-09 14:26:52 +00:00
"editor.formatOnPaste" = true;
"editor.formatOnSave" = true;
"editor.formatOnType" = true;
2024-11-09 14:01:22 +00:00
"nix.enableLanguageServer" = true;
"nix.formatterPath" = "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
"nix.serverPath" = "${pkgs.nil}/bin/nil";
2024-11-09 14:26:52 +00:00
"nix.serverSettings" = {
nil.formatting.command = [ "${pkgs.nixfmt-rfc-style}/bin/nixfmt" ];
};
2024-11-14 07:09:46 +00:00
"rust-analyzer.diagnostics.experimental.enable" = true;
"rust-analyzer.diagnostics.styleLints.enable" = true;
"rust-analyzer.hover.actions.references.enable" = true;
"rust-analyzer.imports.granularity.enforce" = true;
"rust-analyzer.inlayHints.bindingModeHints.enable" = true;
"rust-analyzer.inlayHints.closureCaptureHints.enable" = true;
"rust-analyzer.inlayHints.closureReturnTypeHints.enable" = "always";
"rust-analyzer.inlayHints.discriminantHints.enable" = "always";
"rust-analyzer.inlayHints.lifetimeElisionHints.enable" = "always";
"rust-analyzer.inlayHints.lifetimeElisionHints.useParameterNames" = true;
"rust-analyzer.inlayHints.rangeExclusiveHints.enable" = true;
"rust-analyzer.inlayHints.typeHints.hideClosureInitialization" = false;
"rust-analyzer.interpret.tests" = true;
"rust-analyzer.lens.references.adt.enable" = true;
"rust-analyzer.lens.references.enumVariant.enable" = true;
"rust-analyzer.lens.references.method.enable" = true;
"rust-analyzer.lens.references.trait.enable" = true;
2024-11-09 14:26:52 +00:00
"sops.binPath" = "${pkgs.sops}/bin/sops";
2024-11-09 14:01:22 +00:00
"workbench.iconTheme" = "material-icon-theme";
};
2024-11-09 12:02:10 +00:00
};
2024-11-09 12:05:06 +00:00
services.vscode-server.enable = true;
2024-11-17 07:51:07 +00:00
systemd.user.tmpfiles.rules = lib.mkMerge [
[
"d /persistent${config.xdg.cacheHome}/Code/Cache - - - - -"
"d /persistent${config.xdg.cacheHome}/Code/CachedData - - - - -"
"d /persistent${config.xdg.cacheHome}/Code/CachedProfilesData - - - - -"
"d /persistent${config.xdg.cacheHome}/Code/Code\x20Cache - - - - -"
"d /persistent${config.xdg.cacheHome}/Code/DawnGraphiteCache - - - - -"
"d /persistent${config.xdg.dataHome}/Code - - - - -"
"L /persistent${config.xdg.dataHome}/Code/Cache - - - - ${config.xdg.cacheHome}/Code/Cache"
"L /persistent${config.xdg.dataHome}/Code/CachedData - - - - ${config.xdg.cacheHome}/Code/CachedData"
"L /persistent${config.xdg.dataHome}/Code/CachedProfilesData - - - - ${config.xdg.cacheHome}/Code/CachedProfilesData"
"L /persistent${config.xdg.dataHome}/Code/Code\x20Cache - - - - ${config.xdg.cacheHome}/Code/Code\x20Cache"
"L /persistent${config.xdg.dataHome}/Code/DawnGraphiteCache - - - - ${config.xdg.cacheHome}/Code/DawnGraphiteCache"
"L ${config.xdg.configHome}/Code - - - - ${config.xdg.dataHome}/Code"
]
2024-11-17 08:08:53 +00:00
# GPU Cache sometimes breaks for electron apps on intel, so only persist that on non-intel
2024-11-17 07:51:07 +00:00
(lib.mkIf (!systemConfig.isIntelGPU) [
"d /persistent${config.xdg.cacheHome}/Code/DawnWebGPUCache - - - - -"
"d /persistent${config.xdg.cacheHome}/Code/GPUCache - - - - -"
"L /persistent${config.xdg.dataHome}/Code/DawnWebGPUCache - - - - ${config.xdg.cacheHome}/Code/DawnWebGPUCache"
"L /persistent${config.xdg.dataHome}/Code/GPUCache - - - - ${config.xdg.cacheHome}/Code/GPUCache"
])
(lib.mkIf (systemConfig.isIntelGPU) [
"d /tmp${config.xdg.cacheHome}/Code/DawnWebGPUCache - - - - -"
"d /tmp${config.xdg.cacheHome}/Code/GPUCache - - - - -"
"L /persistent${config.xdg.dataHome}/Code/DawnWebGPUCache - - - - /tmp${config.xdg.cacheHome}/Code/DawnWebGPUCache"
"L /persistent${config.xdg.dataHome}/Code/GPUCache - - - - /tmp${config.xdg.cacheHome}/Code/GPUCache"
])
2024-11-17 07:51:07 +00:00
];
home.persistence.default.directories = [
".local/share/Code"
];
2024-11-09 12:02:10 +00:00
}