persist vscode

This commit is contained in:
Charlotte 🦝 Delenk 2024-11-17 08:51:07 +01:00
parent 855ffc9470
commit e142385714
3 changed files with 36 additions and 1 deletions

View file

@ -18,6 +18,7 @@
"usb_storage"
"sd_mod"
];
isIntelGPU = true;
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];

View file

@ -22,6 +22,7 @@ with lib;
options.isGraphical = mkEnableOption "Whether or not this configuration is a graphical install";
options.isInstaller = mkEnableOption "Whether or not this configuration is an installer and has no access to secrets";
options.isNSFW = mkEnableOption "Whether or not this configuration is NSFW";
options.isIntelGPU = mkEnableOption "Whether or not this configuration uses an Intel GPU";
config =
if !inTester then

View file

@ -1,4 +1,11 @@
{ vscode-server, pkgs, ... }:
{
vscode-server,
config,
systemConfig,
lib,
pkgs,
...
}:
{
imports = [
"${vscode-server}/modules/vscode-server/home.nix"
@ -58,4 +65,30 @@
};
};
services.vscode-server.enable = true;
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"
]
(lib.mkIf (!systemConfig.isIntelGPU) [
# GPU Cache sometimes breaks for electron apps on intel
"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"
])
];
home.persistence.default.directories = [
".local/share/Code"
];
}