nixos/settings/stylix.nix

131 lines
3.6 KiB
Nix
Raw Normal View History

{ config, pkgs, lib, inputs, ... }:
{
imports = [ inputs.stylix.nixosModules.stylix ];
config = lib.mkIf (lib.elem config.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ]) {
stylix = {
enable = true;
image = "${inputs.self}/walls/wallpaper.png";
polarity = "dark";
# Let stylix theme every target it supports. Per-target opt-outs go
# under home-manager.users.fred.stylix.targets.<x>.enable = false.
autoEnable = true;
cursor = {
package = pkgs.adwaita-icon-theme;
name = "Adwaita";
size = 24;
};
fonts = {
monospace = {
package = pkgs.nerd-fonts.fira-mono;
name = "FiraMono Nerd Font";
};
sansSerif = {
package = pkgs.inter;
name = "Inter";
};
serif = {
package = pkgs.inter;
name = "Inter";
};
};
};
home-manager.users.fred = { config, lib, pkgs, ... }: {
# Folder icon recolor — was a matugen post-hook, now driven by
# stylix's base16 palette. base0D is the conventional blue/accent
# slot, which is what we want for Adwaita-style folder icons.
home.activation.recolorFolders = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
ICON_DIR="$HOME/.local/share/icons/WallpaperAdwaita"
ADWAITA="/run/current-system/sw/share/icons/Adwaita"
PAPIRUS="/run/current-system/sw/share/icons/Papirus-Dark"
PRIMARY="#${config.lib.stylix.colors.base0D}"
$DRY_RUN_CMD mkdir -p "$ICON_DIR/scalable/places"
$DRY_RUN_CMD cat > "$ICON_DIR/index.theme" << 'THEME'
[Icon Theme]
Name=WallpaperAdwaita
Comment=Adwaita with stylix-coloured folders and Papirus mimetypes
Inherits=Adwaita,hicolor
DisplayDepth=32
[scalable/places]
Size=128
MinSize=16
MaxSize=512
Type=Scalable
Context=Places
[16x16/mimetypes]
Size=16
Type=Fixed
Context=MimeTypes
[22x22/mimetypes]
Size=22
Type=Fixed
Context=MimeTypes
[32x32/mimetypes]
Size=32
Type=Fixed
Context=MimeTypes
[48x48/mimetypes]
Size=48
Type=Fixed
Context=MimeTypes
[64x64/mimetypes]
Size=64
MinSize=32
MaxSize=128
Type=Scalable
Context=MimeTypes
[96x96/mimetypes]
Size=96
MinSize=64
MaxSize=256
Type=Scalable
Context=MimeTypes
[128x128/mimetypes]
Size=128
MinSize=64
MaxSize=512
Type=Scalable
Context=MimeTypes
THEME
if [ -d "$ADWAITA/scalable/places" ]; then
for svg in "$ADWAITA/scalable/places"/*.svg; do
name=$(basename "$svg")
$DRY_RUN_CMD sed \
-e "s/#438de6/$PRIMARY/gi" \
-e "s/#62a0ea/$PRIMARY/gi" \
-e "s/#a4caee/$PRIMARY/gi" \
-e "s/#afd4ff/$PRIMARY/gi" \
-e "s/#c0d5ea/$PRIMARY/gi" \
"$svg" > "$ICON_DIR/scalable/places/$name"
done
fi
for size in 16x16 22x22 32x32 48x48 64x64 96x96 128x128; do
if [ -d "$PAPIRUS/$size/mimetypes" ]; then
$DRY_RUN_CMD rm -rf "$ICON_DIR/$size/mimetypes"
$DRY_RUN_CMD mkdir -p "$ICON_DIR/$size/mimetypes"
$DRY_RUN_CMD cp -rL "$PAPIRUS/$size/mimetypes"/* "$ICON_DIR/$size/mimetypes/"
fi
done
$DRY_RUN_CMD ${pkgs.gtk3}/bin/gtk-update-icon-cache -f "$ICON_DIR" 2>/dev/null || true
'';
};
};
}