Migrate to hm managed theme switch
This commit is contained in:
@@ -15,6 +15,5 @@
|
||||
./gitlab
|
||||
./jenkins
|
||||
./gaming
|
||||
./theme
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
{ config, lib, pkgs, username, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
# Access HM theme config
|
||||
hmCfg = config.home-manager.users.${username}.dov.dynamic-theme;
|
||||
|
||||
allThemes = hmCfg.themes;
|
||||
|
||||
# Generate all theme-variant combinations
|
||||
themeVariants = concatMapAttrs (name: theme: {
|
||||
"${name}-dark" = { scheme = theme.dark; polarity = "dark"; };
|
||||
"${name}-light" = { scheme = theme.light; polarity = "light"; };
|
||||
}) allThemes;
|
||||
|
||||
# Base is gruvbox-dark, everything else is a specialisation
|
||||
baseVariant = "gruvbox-dark";
|
||||
specialisationVariants = filterAttrs (name: _: name != baseVariant) themeVariants;
|
||||
|
||||
availableVariants = concatStringsSep " " (attrNames themeVariants);
|
||||
|
||||
theme-switch = pkgs.writeShellScriptBin "theme-switch" ''
|
||||
case "$1" in
|
||||
${baseVariant})
|
||||
echo "Switching to ${baseVariant}..."
|
||||
sudo nixos-rebuild switch --flake ~/nixos#${username}
|
||||
;;
|
||||
${concatStringsSep "\n " (map (name: ''
|
||||
${name})
|
||||
echo "Switching to ${name}..."
|
||||
sudo nixos-rebuild switch --flake ~/nixos#${username} --specialisation ${name}
|
||||
;;'') (attrNames specialisationVariants))}
|
||||
*)
|
||||
echo "Usage: theme-switch <variant>"
|
||||
echo "Available: ${availableVariants}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
'';
|
||||
|
||||
in {
|
||||
options.dov.dynamic-theme.enable = mkEnableOption "NixOS dynamic theme specialisations";
|
||||
|
||||
config = mkIf (config.dov.dynamic-theme.enable && hmCfg.enable) {
|
||||
# Add theme-switch script system-wide
|
||||
environment.systemPackages = [ theme-switch ];
|
||||
|
||||
# Base theme: gruvbox-dark
|
||||
stylix = {
|
||||
base16Scheme = mkDefault themeVariants.${baseVariant}.scheme;
|
||||
polarity = mkDefault themeVariants.${baseVariant}.polarity;
|
||||
};
|
||||
|
||||
# Generate NixOS specialisations for all other variants
|
||||
specialisation = mapAttrs (name: variant: {
|
||||
configuration = {
|
||||
stylix = {
|
||||
base16Scheme = mkForce variant.scheme;
|
||||
polarity = mkForce variant.polarity;
|
||||
};
|
||||
};
|
||||
}) specialisationVariants;
|
||||
};
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
with lib;
|
||||
|
||||
let
|
||||
colors = config.lib.stylix.colors;
|
||||
cfg = config.dov.window-manager.hypr;
|
||||
hm-cfg = config.home-manager.users.${username}.dov;
|
||||
in {
|
||||
@@ -249,31 +248,6 @@ in {
|
||||
'';
|
||||
};
|
||||
|
||||
# Stylix base16 palette exported as hyprlang variables. No longer sourced
|
||||
# from the main Lua config (Lua has no `source`); kept for reference and
|
||||
# for any hyprlang consumer that wants to source it.
|
||||
home.file.".config/hypr/colors".text = ''
|
||||
$background = ${colors.base00}
|
||||
$foreground = ${colors.base05}
|
||||
|
||||
$color0 = ${colors.base00}
|
||||
$color1 = ${colors.base01}
|
||||
$color2 = ${colors.base02}
|
||||
$color3 = ${colors.base03}
|
||||
$color4 = ${colors.base04}
|
||||
$color5 = ${colors.base05}
|
||||
$color6 = ${colors.base06}
|
||||
$color7 = ${colors.base07}
|
||||
$color8 = ${colors.base08}
|
||||
$color9 = ${colors.base09}
|
||||
$color10 = ${colors.base0A}
|
||||
$color11 = ${colors.base0B}
|
||||
$color12 = ${colors.base0C}
|
||||
$color13 = ${colors.base0D}
|
||||
$color14 = ${colors.base0E}
|
||||
$color15 = ${colors.base0F}
|
||||
'';
|
||||
|
||||
xdg.configFile."hypr/hyprlock.conf".source = ./hyprlock.conf;
|
||||
xdg.configFile."hypr/hypridle.conf".source = ./hypridle.conf;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user