fixup! fixup! Install lucid

This commit is contained in:
Sweetbread committed 2026-11-02 22:26:43 +03:00
1 parent cb90233704
commit 6d61c18792
1 file changed
+53 -36
+53 -36
View File
@@ -23,48 +23,48 @@ let
defaultWallpaper = "${wallpaperDir}/bluehour.jpg"; defaultWallpaper = "${wallpaperDir}/bluehour.jpg";
hyprLua = import ../../../modules/user/hyprland/lua.nix { inherit lib; }; hyprLua = import ../../../modules/user/hyprland/lua.nix { inherit lib; };
colors = config.lib.stylix.colors.withHashtag; colors = config.lib.stylix.colors.withHashtag;
accent = colors.${config.stylix.accent}; paletteFile = pkgs.runCommand "lucid-stylix-palette.json" {
palette = { nativeBuildInputs = [ pkgs.python3 ];
primary = accent; } ''
on_primary = colors.base00; python3 - "$out" ${lib.escapeShellArg config.stylix.base16Scheme} \
primary_container = accent; ${lib.escapeShellArg "${source}/support/lucid"} \
on_primary_container = colors.base05; ${lib.escapeShellArg config.stylix.accent} <<'PY'
secondary = colors.base0D; import json
secondary_container = colors.base02; import runpy
tertiary = colors.base0E; import sys
on_tertiary = colors.base00; from pathlib import Path
error = colors.base08;
on_error = colors.base00; output, scheme_path, scripts, accent_key = sys.argv[1:]
error_container = colors.base03; sys.path.insert(0, scripts)
surface = colors.base00; importer = runpy.run_path(str(Path(scripts) / "add-theme.py"))
on_surface = colors.base05; scheme = importer["parse_base16"](scheme_path, Path(scheme_path).read_text())
surface_variant = colors.base02; if scheme is None:
on_surface_variant = colors.base07; raise SystemExit("Stylix scheme is not valid Base16")
surface_dim = colors.base01; bg, fg, accents, hints = importer["to_palette"](scheme)
surface_container_lowest = colors.base01; accent_key = accent_key.lower()
surface_container_low = colors.base00; hints["primary"] = scheme["colors"][accent_key]
surface_container = colors.base00; hints["secondary"] = scheme["colors"]["base0d" if accent_key != "base0d" else "base0e"]
surface_container_high = colors.base02; hints["tertiary"] = scheme["colors"]["base0c" if accent_key == "base0b" else "base0b"]
surface_container_highest = colors.base03; palette = importer["build_palette"](
outline = colors.base04; bg, fg, accents, hints, mode="dark" if importer["is_dark"](bg) else "light"
outline_variant = colors.base02; )
inverse_surface = colors.base05; Path(output).write_text(json.dumps(palette, indent=2) + "\n")
shadow = "#000000"; PY
scrim = "#000000"; '';
source_color = accent;
};
paletteFile = pkgs.writeText "lucid-stylix-palette.json" (builtins.toJSON palette);
themeMeta = pkgs.writeText "lucid-stylix-meta.json" (builtins.toJSON { themeMeta = pkgs.writeText "lucid-stylix-meta.json" (builtins.toJSON {
id = "stylix"; id = "stylix";
name = "Stylix"; name = "Stylix";
desc = "Active Stylix palette"; desc = "Active Stylix palette";
swatchBg = colors.base00; swatchBg = colors.base00;
swatchAccent = accent; swatchAccent = colors.${config.stylix.accent};
source = "Home Manager"; source = "Home Manager";
detected = "base16"; detected = "base16";
user = true; user = true;
}); });
themeName = pkgs.writeText "lucid-current-theme" "stylix\n"; themeName = pkgs.writeText "lucid-current-theme" "stylix\n";
applyTheme = pkgs.writeShellScript "lucid-apply-theme" ''
exec "$HOME/.config/lucid/apply-theme-upstream.sh" --shell-only "$@"
'';
qmlPackages = with pkgs.qt6; [ qt5compat qtmultimedia ]; qmlPackages = with pkgs.qt6; [ qt5compat qtmultimedia ];
lucid = pkgs.writeShellScript "lucid" '' lucid = pkgs.writeShellScript "lucid" ''
export NIXPKGS_QT6_QML_IMPORT_PATH="${lib.makeSearchPath "lib/qt-6/qml" qmlPackages}:''${NIXPKGS_QT6_QML_IMPORT_PATH:-}" export NIXPKGS_QT6_QML_IMPORT_PATH="${lib.makeSearchPath "lib/qt-6/qml" qmlPackages}:''${NIXPKGS_QT6_QML_IMPORT_PATH:-}"
@@ -121,6 +121,18 @@ in {
$DRY_RUN_CMD install -m755 "${source}/support/wallpaper/set-wallpaper.sh" \ $DRY_RUN_CMD install -m755 "${source}/support/wallpaper/set-wallpaper.sh" \
"${wallpaperScript}" "${wallpaperScript}"
lucid_dir="${config.home.homeDirectory}/.config/lucid"
$DRY_RUN_CMD mkdir -p "$lucid_dir/themes"
$DRY_RUN_CMD ${pkgs.rsync}/bin/rsync -rltp --chmod=Du+rwx,Fu+rw --ignore-existing \
"${source}/support/lucid/themes/" "$lucid_dir/themes/"
for script in palette-edit.py lucid_palette.py add-theme.py scheme-gallery.py gen-light-palette.py; do
$DRY_RUN_CMD install -m644 "${source}/support/lucid/$script" "$lucid_dir/$script"
done
$DRY_RUN_CMD install -m755 "${source}/support/lucid/apply-theme.sh" \
"$lucid_dir/apply-theme-upstream.sh"
$DRY_RUN_CMD install -m755 ${applyTheme} \
"$lucid_dir/apply-theme.sh"
if [ ! -e "$target/lucidprefs/prefs.json" ]; then if [ ! -e "$target/lucidprefs/prefs.json" ]; then
$DRY_RUN_CMD install -m644 ${../../../modules/user/lucid-prefs.json} "$target/lucidprefs/prefs.json" $DRY_RUN_CMD install -m644 ${../../../modules/user/lucid-prefs.json} "$target/lucidprefs/prefs.json"
fi fi
@@ -165,10 +177,15 @@ in {
"${config.home.homeDirectory}/.config/lucid/themes/stylix/quickshell.json" "${config.home.homeDirectory}/.config/lucid/themes/stylix/quickshell.json"
$DRY_RUN_CMD install -m644 ${themeMeta} \ $DRY_RUN_CMD install -m644 ${themeMeta} \
"${config.home.homeDirectory}/.config/lucid/themes/stylix/meta.json" "${config.home.homeDirectory}/.config/lucid/themes/stylix/meta.json"
$DRY_RUN_CMD install -m644 ${paletteFile} \ if [ ! -e "${config.home.homeDirectory}/.cache/current_theme" ]; then
"${config.home.homeDirectory}/.cache/quickshell/matugen.json" $DRY_RUN_CMD install -m644 ${themeName} \
$DRY_RUN_CMD install -m644 ${themeName} \ "${config.home.homeDirectory}/.cache/current_theme"
"${config.home.homeDirectory}/.cache/current_theme" fi
if [ ! -e "${config.home.homeDirectory}/.cache/current_theme" ] || \
[ "$(${pkgs.coreutils}/bin/cat "${config.home.homeDirectory}/.cache/current_theme")" = stylix ]; then
$DRY_RUN_CMD install -m644 ${paletteFile} \
"${config.home.homeDirectory}/.cache/quickshell/matugen.json"
fi
''; '';
systemd.user.services.lucid = { systemd.user.services.lucid = {