IBNPMUOIC6ZWL5D2YK5HNBQ23FSLCKGDD4B7B77VDXHHW4E7FY3AC JV2GDHIK5NPTIRUWEV5QY3FSBJTDDNMDA345ASZJY4CE4TIB63GAC 25AL22PMXNPRORHOO66MT3Y32FHRNDVL7XD3Y3DUVBZPX6MY5JMAC 52JZLFIA4TLBPX2OACDOZ4BKNX3TJ33W5O2ZP7ACKI34N7RBZQVQC OUPAW7IENNTRLHI5ET2ZV4235FCCHNPVRGRE5HGQNDHIK63IMK6QC QRPPLHLL6YZU3Z35JNJFXHMBY3BX4THHN4AMWDFCUSFHYAHWTRHAC E5WANV7PYNPZFSJE4AMZABQ76TUNKVZN3M6ZFD5V6CKAFKG444NAC HQ4UTQK5UQXMEUZRYQSCTEKW73UZLJQHPA4YD75FCKBKHS5NMJOAC SCB7IK7YNYAR3WTV2XYGPYCGCUW2GPJSWAA5S2ZGCYSZ5AZKXIDAC QOY7D3GZ3WF7HAMEHAW2CIUB5TDQCFE3YDZEO23R5MFQEBN635WAC 5G7WRBMWKG6DMCOHE6WQHTYZACUHO2UPBZRWN72CFH7P45NN5E7QC I4HWXLAAKJHZUQFV23XBAAEW6VTCOXO2F3AB5R6RTOHHZBZLK2VAC 4CGMXOB255STMJ54SMBREWY6SNFL7NCQ7CC4VKCAVO2RC5ZQRGLAC DLMU5B7JBMU5J7HSRMPD7OYA7AY5OCT2ZWUKKF2X3SFHE6OTV6TAC RXJH46XLP6AFSIZZD4WEQA5A5YZLKHZ54ZUGCRH7TRAOH2Z4Q2VQC J2R5LDKL2CVL7YJAYNSGSOQID7U7B2OMGV4AMQMPUSX7N76JQPXAC # Global theme configuration - use `tt dark` or `tt light` to switch.is_dark = true;
# Global theme configuration - can be overridden by specialisations.is_dark = if config.themeOverride != nullthen config.themeOverrideelse false; # Default to light.
# Export theme info as env var.config.environment.variables.THEME_MODE = variant;
# Export theme info as environment variable.config.environment.variables.THEME_MODE = variant;config.environment.sessionVariables.THEME_MODE = variant;
{ config, lib, ... }: letinherit (lib) mkIf;in {config = mkIf config.isDesktopNotWsl {# Specialisations for system-level theme switching.specialisation = {dark-theme = {configuration = {# Force dark theme.themeOverride = lib.mkForce true;# For identification.system.nixos.tags = [ "dark-theme" ];# Include the light theme specialisation in dark theme.specialisation.light-theme = {configuration = {themeOverride = lib.mkForce false;system.nixos.tags = [ "light-theme" ];};};};};# Light theme specialisation.light-theme = {configuration = {# Force light theme.themeOverride = lib.mkForce false;# For identification.system.nixos.tags = [ "light-theme" ];# Include the dark theme specialisation in light theme.specialisation.dark-theme = {configuration = {themeOverride = lib.mkForce true;system.nixos.tags = [ "dark-theme" ];};};};};};# Home Manager specialisations for user-level theme switching.home-manager.sharedModules = [{specialisation = {dark = {configuration = {# Override theme to dark in home-manager.home.sessionVariables.THEME_MODE = "dark";};};light = {configuration = {# Override theme to light in home-manager.home.sessionVariables.THEME_MODE = "light";};};};}];};}
# determine current theme from nix theme filelet theme_file = $"($env.HOME)/nixos/modules/common/theme.nix"let current_theme = try {let content = open $theme_fileif ($content | str contains "is_dark = true;") {"dark"} else {"light"}} catch {"light"}# use provided theme or toggle currentlet new_theme = if $theme != null {if $theme in ["light", "dark"] {$theme} else {print $"Invalid theme: ($theme). Use 'light' or 'dark'"return}
# Use provided theme.let new_theme = if $theme in ["light", "dark"] {$theme
let updated = if $new_theme == "dark" {$content | str replace "is_dark = false;" "is_dark = true;"
print_notify $"Activating ($new_theme) specialisation."if $new_theme == "dark" {^sudo /run/current-system/specialisation/dark-theme/bin/switch-to-configuration switch
# check current themedef current-theme [] {let theme_file = $"($env.HOME)/nixos/modules/common/theme.nix"try {let content = open $theme_fileif ($content | str contains "is_dark = true;") {"dark"} else {"light"}} catch {"light"}