feat(home): enhance user environment and dynamic theming
- Implement dynamic palette generation from colors.toml themes - Update script wrapper to handle non-executable source files - Integrate Stylix for unified application theming - Add state-based logic for persistent dynamic configurations
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
normal = { family = config.nomarchy.fonts.monospace; style = "Regular"; };
|
normal = { family = config.nomarchy.fonts.monospace; style = "Regular"; };
|
||||||
bold = { family = config.nomarchy.fonts.monospace; style = "Bold"; };
|
bold = { family = config.nomarchy.fonts.monospace; style = "Bold"; };
|
||||||
italic = { family = config.nomarchy.fonts.monospace; style = "Italic"; };
|
italic = { family = config.nomarchy.fonts.monospace; style = "Italic"; };
|
||||||
size = 9;
|
size = lib.mkForce 9;
|
||||||
};
|
};
|
||||||
window = {
|
window = {
|
||||||
padding = { x = 14; y = 14; };
|
padding = { x = 14; y = 14; };
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
palettes = import ../../themes/nomarchy-palettes.nix;
|
palettes = import ../../themes/nomarchy-palettes.nix;
|
||||||
# Reads the state file. If it doesn't exist, defaults to dracula.
|
# Reads the state file. If it doesn't exist, defaults to nord.
|
||||||
stateFile = "${config.home.homeDirectory}/.config/home-manager/theme-state.nix";
|
stateFile = "${config.home.homeDirectory}/.config/home-manager/theme-state.nix";
|
||||||
activeThemeName = if builtins.pathExists stateFile then
|
activeThemeName = if builtins.pathExists stateFile then
|
||||||
lib.removeSuffix "\n" (builtins.readFile stateFile)
|
lib.removeSuffix "\n" (builtins.readFile stateFile)
|
||||||
else "dracula";
|
else "nord";
|
||||||
userPackagesFile = "${config.home.homeDirectory}/.config/home-manager/user-packages.json";
|
userPackagesFile = "${config.home.homeDirectory}/.config/home-manager/user-packages.json";
|
||||||
userPackages = if builtins.pathExists userPackagesFile then
|
userPackages = if builtins.pathExists userPackagesFile then
|
||||||
let
|
let
|
||||||
@@ -31,13 +31,14 @@ in
|
|||||||
./theme-switcher.nix
|
./theme-switcher.nix
|
||||||
./scripts.nix
|
./scripts.nix
|
||||||
./configs.nix
|
./configs.nix
|
||||||
|
./swayosd.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
colorScheme = palettes.${activeThemeName} or palettes.dracula;
|
colorScheme = palettes.${activeThemeName} or palettes.nord;
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
firefox
|
firefox
|
||||||
thunar
|
xfce.thunar
|
||||||
imv
|
imv
|
||||||
mpv
|
mpv
|
||||||
neovim
|
neovim
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ let
|
|||||||
hyprsunsetState = if builtins.pathExists stateFile then
|
hyprsunsetState = if builtins.pathExists stateFile then
|
||||||
builtins.fromJSON (builtins.readFile stateFile)
|
builtins.fromJSON (builtins.readFile stateFile)
|
||||||
else { enabled = false; temperature = 4000; };
|
else { enabled = false; temperature = 4000; };
|
||||||
|
temp = toString (if hyprsunsetState.enabled then hyprsunsetState.temperature else 6500);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.hyprsunset = {
|
services.hyprsunset = {
|
||||||
enable = true; # Always enabled, we control via IPC and state
|
enable = true; # Always enabled, we control via IPC and state
|
||||||
temperature = if hyprsunsetState.enabled then hyprsunsetState.temperature else 6500;
|
extraArgs = [ "--temperature" temp ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ let
|
|||||||
brightnessctl
|
brightnessctl
|
||||||
playerctl
|
playerctl
|
||||||
pamixer
|
pamixer
|
||||||
|
pulseaudio
|
||||||
|
wireplumber
|
||||||
|
swayosd
|
||||||
|
gawk
|
||||||
|
curl
|
||||||
|
wget
|
||||||
# Add any others commonly used in bin/
|
# Add any others commonly used in bin/
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -34,10 +40,15 @@ let
|
|||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp -r * $out/bin/
|
cp -r * $out/bin/
|
||||||
|
chmod +x $out/bin/*
|
||||||
|
|
||||||
# Wrap every script to ensure dependencies are in PATH
|
# Wrap every script to ensure dependencies are in PATH
|
||||||
find $out/bin -type f -exec wrapProgram {} \
|
for file in $out/bin/*; do
|
||||||
--prefix PATH : ${lib.makeBinPath nomarchy-deps} \;
|
if [ -f "$file" ]; then
|
||||||
|
wrapProgram "$file" \
|
||||||
|
--prefix PATH : ${lib.makeBinPath nomarchy-deps}
|
||||||
|
fi
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ let
|
|||||||
themeStateFile = "${config.home.homeDirectory}/.config/home-manager/theme-state.nix";
|
themeStateFile = "${config.home.homeDirectory}/.config/home-manager/theme-state.nix";
|
||||||
activeThemeName = if builtins.pathExists themeStateFile then
|
activeThemeName = if builtins.pathExists themeStateFile then
|
||||||
lib.removeSuffix "\n" (builtins.readFile themeStateFile)
|
lib.removeSuffix "\n" (builtins.readFile themeStateFile)
|
||||||
else "dracula";
|
else "nord";
|
||||||
|
|
||||||
wallpaperStateFile = "${config.home.homeDirectory}/.config/home-manager/wallpaper-state.nix";
|
wallpaperStateFile = "${config.home.homeDirectory}/.config/home-manager/wallpaper-state.nix";
|
||||||
activeWallpaper = if builtins.pathExists wallpaperStateFile then
|
activeWallpaper = if builtins.pathExists wallpaperStateFile then
|
||||||
@@ -15,13 +15,14 @@ let
|
|||||||
else "${../../themes/catppuccin/backgrounds/1-totoro.png}"; # Fallback
|
else "${../../themes/catppuccin/backgrounds/1-totoro.png}"; # Fallback
|
||||||
|
|
||||||
# Map nix-colors palette to a format Stylix expects (attrset of hex strings)
|
# Map nix-colors palette to a format Stylix expects (attrset of hex strings)
|
||||||
currentPalette = (palettes.${activeThemeName} or palettes.dracula).palette;
|
currentPalette = (palettes.${activeThemeName} or palettes.nord).palette;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.stylix.homeModules.stylix ];
|
imports = [ inputs.stylix.homeModules.stylix ];
|
||||||
|
|
||||||
stylix = {
|
stylix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
enableReleaseChecks = false;
|
||||||
image = activeWallpaper;
|
image = activeWallpaper;
|
||||||
base16Scheme = currentPalette;
|
base16Scheme = currentPalette;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ let
|
|||||||
themesDir = ./.;
|
themesDir = ./.;
|
||||||
|
|
||||||
# Get all directories in the themes folder that have a colors.toml file
|
# Get all directories in the themes folder that have a colors.toml file
|
||||||
directories = builtins.attrNames (
|
allEntries = builtins.readDir themesDir;
|
||||||
builtins.filterAttrs (name: type: type == "directory" && builtins.pathExists (themesDir + "/${name}/colors.toml")) (builtins.readDir themesDir)
|
directories = builtins.filter (name:
|
||||||
);
|
allEntries.${name} == "directory" && builtins.pathExists (themesDir + "/${name}/colors.toml")
|
||||||
|
) (builtins.attrNames allEntries);
|
||||||
|
|
||||||
readTheme = name:
|
readTheme = name:
|
||||||
let
|
let
|
||||||
|
|||||||
Reference in New Issue
Block a user