Add basic theme config

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-06-23 14:50:50 +03:00
parent 48f391e3ad
commit e7d328cab5
23 changed files with 554 additions and 188 deletions

View File

@@ -1,27 +1,12 @@
{ user ? throw "user argument is required" }: { inputs, lib, pkgs, ... }:
let
configDir = ".config/Code";
cacheDirs = [
".config/Code/Cache"
".config/Code/CachedConfigurations"
".config/Code/CachedData"
".config/Code/CachedExtensionVSIXs"
".config/Code/CachedExtensions"
".config/Code/CachedProfilesData"
".config/Code/Code Cache"
".config/Code/DawnCache"
".config/Code/GPUCache"
".config/Code/Service Worker/CacheStorage"
".config/Code/Service Worker/ScriptCache"
];
inherit (pkgs.callPackage "${inputs.impermanence}/lib.nix" { }) sanitizeName concatPaths;
in {
{
home-manager.users."${user.name}" = {
programs.vscode = {
enable = true;
mutableExtensionsDir = false;
userSettings = {
"diffEditor.ignoreTrimWhitespace" = false;
"editor.accessibilitySupport" = "off";
"editor.cursorBlinking" = "phase";
"editor.cursorSmoothCaretAnimation" = "on";
@@ -76,27 +61,24 @@ in {
];
home.persistence = {
"/persist${user.home}".directories = [ configDir ];
"/persist${user.home}".directories = [ ".config/Code" ];
# Bastard: https://github.com/microsoft/vscode/issues/3884
"/cache${user.home}".directories = cacheDirs;
# Even bigger Bastards:
# - https://github.com/nix-community/impermanence/issues/22
# - https://github.com/nix-community/impermanence/pull/97
# "/cache${user.home}".directories = [
# ".config/Code/Cache"
# ".config/Code/CachedConfigurations"
# ".config/Code/CachedData"
# ".config/Code/CachedExtensionVSIXs"
# ".config/Code/CachedExtensions"
# ".config/Code/CachedProfilesData"
# ".config/Code/Code Cache"
# ".config/Code/DawnCache"
# ".config/Code/GPUCache"
# ".config/Code/Service Worker/CacheStorage"
# ".config/Code/Service Worker/ScriptCache"
# ];
};
# Some filthy fucking shit below, be warned.
# Microsoft stores cache under .config/Code instead of .cache/Code like normal people.
# Sometimes a race condition is caused if the cache bind mounts are created before the config one.
# So we do this. Sorry.
# https://github.com/nix-community/impermanence/blob/27979f1c3a0d3b9617a3563e2839114ba7d48d3f/home-manager.nix#L238
systemd.user.services = let
configDirService = "bindMount-${sanitizeName (lib.strings.escapeShellArg (concatPaths [ "/persist${user.home}" configDir ]))}.service";
in
builtins.listToAttrs (builtins.map (dir: {
name = "bindMount-${sanitizeName (lib.strings.escapeShellArg (concatPaths [ "/cache${user.home}" dir ]))}";
value = {
Unit = {
Requires = [ configDirService ];
After = [ configDirService ];
};
};
}) cacheDirs);
};
}

View File

@@ -5,7 +5,7 @@
userSettings = {
"nix.enableLanguageServer" = true;
"nix.formatterPath" = "nixpkgs-fmt";
"nix.serverSettings" = {};
"nix.serverSettings" = { };
};
extensions = with pkgs; with vscode-extensions; [
jnoortheen.nix-ide