Update flake, theme gtk, add vscode cache

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-06-25 11:10:32 +03:00
parent bedf27aa5f
commit 193c665aa4
11 changed files with 160 additions and 297 deletions

View File

@@ -9,7 +9,7 @@ in
enable = mkEnableOption "matugen";
package = mkPackageOption pkgs "matugen" { };
settings = mkOption {
type = attrs;
type = attrsOf anything;
description = "Settings to write to config.toml.";
};
};

View File

@@ -153,10 +153,7 @@ in
};
mode = mkOption {
type = enum [
"dark"
"light"
];
type = enum [ "dark" "light" ];
default = "dark";
description = "The default mode of the theme.";
};

View File

@@ -10,11 +10,17 @@ in
lfs.enable = true;
userName = user.fullName;
userEmail = user.email;
signing = {
signByDefault = true;
key = null;
};
extraConfig.credential.helper = "store";
extraConfig = {
credential.helper = "store";
push.autoSetupRemote = true;
};
hooks = {
commit-msg = let name = "git-commit-msg-hook"; in
"${pkgs.writeShellApplication {

View File

@@ -1,10 +1,50 @@
{ user ? throw "user argument is required" }: { config, ... }:
{ user ? throw "user argument is required" }: { config, pkgs, ... }:
let
hmConfig = config.home-manager.users."${user.name}";
in
{
home-manager.users."${user.name}" = {
gtk.gtk2.configLocation = "${hmConfig.xdg.configHome}/gtk-2.0/gtkrc";
gtk = {
enable = true;
theme = {
package = pkgs.adw-gtk3;
name = "adw-gtk3-dark";
};
gtk2.configLocation = "${hmConfig.xdg.configHome}/gtk-2.0/gtkrc";
gtk3.extraCss = "@import './theme.css';";
gtk4.extraCss = "@import './theme.css';";
};
programs.matugen.settings.templates = {
gtk3 = {
input_path = ./theme.css;
output_path = "${hmConfig.xdg.configHome}/gtk-3.0/theme.css";
};
gtk4 = {
input_path = ./theme.css;
output_path = "${hmConfig.xdg.configHome}/gtk-4.0/theme.css";
};
};
theme.extraConfig = let name = "theme-gtk"; in
"${pkgs.writeShellApplication {
inherit name;
runtimeInputs = with pkgs; [ glib ];
text = ''
MODE=$(cat "${hmConfig.theme.configDir}/mode")
if [ "$MODE" = "light" ]; then
GTK_THEME="adw-gtk3"
else
GTK_THEME="adw-gtk3-dark"
fi
gsettings set org.gnome.desktop.interface gtk-theme "$GTK_THEME"
gsettings set org.gnome.desktop.interface color-scheme "prefer-$MODE"
'';
}}/bin/${name} &";
};
}

View File

@@ -0,0 +1,48 @@
@define-color window_bg_color alpha({{colors.surface.default.hex}}, {{custom.opacity}});
@define-color window_fg_color {{colors.on_surface.default.hex}};
@define-color view_bg_color @window_bg_color;
@define-color view_fg_color @window_fg_color;
@define-color accent_bg_color {{colors.primary_container.default.hex}};
@define-color accent_fg_color {{colors.on_primary.default.hex}};
@define-color accent_color @accent_bg_color;
@define-color headerbar_bg_color @window_bg_color;
@define-color headerbar_fg_color @window_fg_color;
@define-color headerbar_backdrop_color alpha({{colors.surface_variant.default.hex}}, {{custom.opacity}});
@define-color headerbar_shade_color {{colors.shadow.default.hex}};
@define-color card_bg_color alpha({{colors.surface_container.default.hex}}, {{custom.opacity}});
@define-color card_fg_color {{colors.on_surface.default.hex}};
@define-color card_shade_color {{colors.shadow.default.hex}};
@define-color popover_bg_color @window_bg_color;
@define-color popover_fg_color @window_fg_color;
@define-color dialog_bg_color @window_bg_color;
@define-color dialog_fg_color @window_fg_color;
@define-color sidebar_bg_color @card_bg_color;
@define-color sidebar_fg_color @card_fg_color;
@define-color sidebar_backdrop_color alpha({{colors.surface_variant.default.hex}}, {{custom.opacity}});
@define-color sidebar_shade_color @card_shade_color;
@define-color warning_bg_color {{colors.warning_container.default.hex}};
@define-color warning_fg_color {{colors.on_warning.default.hex}};
@define-color warning_color @warning_bg_color;
@define-color error_bg_color {{colors.error_container.default.hex}};
@define-color error_fg_color {{colors.on_error.default.hex}};
@define-color error_color @error_bg_color;
@define-color success_bg_color {{colors.success_container.default.hex}};
@define-color success_fg_color {{colors.on_success.default.hex}};
@define-color success_color @success_bg_color;
@define-color destructive_bg_color {{colors.danger_container.default.hex}};
@define-color destructive_fg_color {{colors.on_danger.default.hex}};
@define-color destructive_color @destructive_bg_color;
@panel_bg_color @window_bg_color
@panel_fg_color @window_fg_color

View File

@@ -20,10 +20,10 @@ color6 {{colors.cyan.default.hex}}
color7 {{colors.on_surface.default.hex}}
color8 {{colors.outline_variant.default.hex}}
color9 {{colors.red.default.hex}}
color10 {{colors.green.default.hex}}
color11 {{colors.yellow.default.hex}}
color12 {{colors.blue.default.hex}}
color13 {{colors.magenta.default.hex}}
color14 {{colors.cyan.default.hex}}
color9 {{ colors.red.default.hex | set_lightness: 5.0 }}
color10 {{ colors.green.default.hex | set_lightness: 5.0 }}
color11 {{ colors.yellow.default.hex | set_lightness: 5.0 }}
color12 {{ colors.blue.default.hex | set_lightness: 5.0 }}
color13 {{ colors.magenta.default.hex | set_lightness: 5.0 }}
color14 {{ colors.cyan.default.hex | set_lightness: 5.0 }}
color15 {{colors.on_surface_variant.default.hex}}

View File

@@ -62,23 +62,20 @@
home.persistence = {
"/persist${user.home}".directories = [ ".config/Code" ];
# Bastard:
# - https://github.com/microsoft/vscode/issues/3884
# - 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"
# ];
# Bastard: https://github.com/microsoft/vscode/issues/3884
"/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"
];
};
};
}