diff --git a/home/tiling/niri/noctalia.nix b/home/tiling/niri/noctalia.nix index 4bc249f..e5f92db 100644 --- a/home/tiling/niri/noctalia.nix +++ b/home/tiling/niri/noctalia.nix @@ -1,85 +1,12 @@ { pkgs, config, - lib, ... }: let - # Get the actual color palettes - darkPalette = pkgs.catppuccin.${config.catppuccin.flavor}; - lightPalette = pkgs.catppuccin.latte; - - # Create theme from palette - mkTheme = palette: accent: { - mPrimary = palette.${accent}; - mOnPrimary = palette.crust; - mSecondary = palette.subtext0; - mOnSecondary = palette.crust; - mTertiary = palette.teal; - mOnTertiary = palette.crust; - mError = palette.red; - mOnError = palette.crust; - mSurface = palette.mantle; - mOnSurface = palette.text; - mSurfaceVariant = palette.surface0; - mOnSurfaceVariant = palette.lavender; - mOutline = palette.surface2; - mShadow = palette.crust; - mHover = palette.subtext1; - mOnHover = palette.crust; + customPackage = pkgs.mkNoctaliaShellCustom { + catppuccin-flavor = config.catppuccin.flavor; + catppuccin-accent = config.catppuccin.accent; }; - - # Build the complete color scheme - customScheme = { - dark = mkTheme darkPalette config.catppuccin.accent; - light = mkTheme lightPalette config.catppuccin.accent; - }; - - # Convert to JSON - schemeJson = builtins.toJSON customScheme; - - customPackage = pkgs.noctalia-shell.overrideAttrs (oldAttrs: { - pname = "noctalia-shell-custom"; - nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [pkgs.jq]; - - postPatch = - (oldAttrs.postPatch or "") - + '' - echo "Patching noctalia-shell with Cat-Custom theme..." - echo " Dark: ${config.catppuccin.flavor} / Light: latte" - echo " Accent: ${config.catppuccin.accent}" - - if [ -d Assets/ColorScheme/Catppuccin ]; then - mkdir -p Assets/ColorScheme/Cat-Custom - - # Write the JSON directly - cat > Assets/ColorScheme/Cat-Custom/Cat-Custom.json << 'COLORSCHEME_EOF' - ${schemeJson} - COLORSCHEME_EOF - - echo "Created Cat-Custom color scheme:" - ${pkgs.jq}/bin/jq -C '.' Assets/ColorScheme/Cat-Custom/Cat-Custom.json || true - - # Add translation entries - for lang in en fr de es pt zh-CN; do - if [ -f "Assets/Translations/$lang.json" ]; then - ${pkgs.jq}/bin/jq \ - '.["color-scheme"].predefined.schemes["Cat-Custom"] = "Cat-Custom"' \ - "Assets/Translations/$lang.json" > "Assets/Translations/$lang.json.tmp" \ - && mv "Assets/Translations/$lang.json.tmp" "Assets/Translations/$lang.json" - fi - done - else - echo "ERROR: ColorScheme directory not found" - exit 1 - fi - ''; - - meta = - oldAttrs.meta - // { - description = "${oldAttrs.meta.description} (Cat-Custom: ${config.catppuccin.flavor}/${config.catppuccin.accent})"; - }; - }); in { programs.noctalia-shell = { enable = true; diff --git a/packages/noctalia-shell/default.nix b/packages/noctalia-shell/default.nix new file mode 100644 index 0000000..0235735 --- /dev/null +++ b/packages/noctalia-shell/default.nix @@ -0,0 +1,82 @@ +{ + pkgs, + noctalia-shell, + catppuccin-flavor, + catppuccin-accent, +}: let + # Get the actual color palettes + darkPalette = pkgs.catppuccin.${catppuccin-flavor}; + lightPalette = pkgs.catppuccin.latte; + + # Create theme from palette + mkTheme = palette: accent: { + mPrimary = palette.${accent}; + mOnPrimary = palette.crust; + mSecondary = palette.subtext0; + mOnSecondary = palette.crust; + mTertiary = palette.teal; + mOnTertiary = palette.crust; + mError = palette.red; + mOnError = palette.crust; + mSurface = palette.mantle; + mOnSurface = palette.text; + mSurfaceVariant = palette.surface0; + mOnSurfaceVariant = palette.lavender; + mOutline = palette.surface2; + mShadow = palette.crust; + mHover = palette.subtext1; + mOnHover = palette.crust; + }; + + # Build the complete color scheme + customScheme = { + dark = mkTheme darkPalette catppuccin-accent; + light = mkTheme lightPalette catppuccin-accent; + }; + + # Convert to JSON + schemeJson = builtins.toJSON customScheme; +in + noctalia-shell.overrideAttrs (oldAttrs: { + pname = "noctalia-shell-custom"; + nativeBuildInputs = (oldAttrs.nativeBuildInputs or []) ++ [pkgs.jq]; + + postPatch = + (oldAttrs.postPatch or "") + + '' + echo "Patching noctalia-shell with Cat-Custom theme..." + echo " Dark: ${catppuccin-flavor} / Light: latte" + echo " Accent: ${catppuccin-accent}" + + if [ -d Assets/ColorScheme/Catppuccin ]; then + mkdir -p Assets/ColorScheme/Cat-Custom + + # Write the JSON directly + cat > Assets/ColorScheme/Cat-Custom/Cat-Custom.json << 'COLORSCHEME_EOF' + ${schemeJson} + COLORSCHEME_EOF + + echo "Created Cat-Custom color scheme:" + ${pkgs.jq}/bin/jq -C '.' Assets/ColorScheme/Cat-Custom/Cat-Custom.json || true + + # Add translation entries + for lang in en fr de es pt zh-CN; do + if [ -f "Assets/Translations/$lang.json" ]; then + ${pkgs.jq}/bin/jq \ + '.["color-scheme"].predefined.schemes["Cat-Custom"] = "Cat-Custom"' \ + "Assets/Translations/$lang.json" > "Assets/Translations/$lang.json.tmp" \ + && mv "Assets/Translations/$lang.json.tmp" "Assets/Translations/$lang.json" + fi + done + else + echo "ERROR: ColorScheme directory not found" + exit 1 + fi + ''; + + meta = + oldAttrs.meta + // { + description = "${oldAttrs.meta.description} (Cat-Custom: ${catppuccin-flavor}/${catppuccin-accent})"; + }; + }) diff --git a/packages/overlay.nix b/packages/overlay.nix index 7db842d..1b84633 100644 --- a/packages/overlay.nix +++ b/packages/overlay.nix @@ -1,13 +1,26 @@ final: prev: { spotify-webapp = final.callPackage ./spotify-webapp {}; + catppuccin-discord = final.callPackage ./catppuccin-discord { inherit (final) catppuccin-discord-git; }; + openmw = final.callPackage ./openmw { openmw = prev.openmw; inherit (final) openmw-git; }; + # Noctalia shell is parameterized by catppuccin theme, so we create a function + # that home-manager configs can call with their specific theme settings + mkNoctaliaShellCustom = { + catppuccin-flavor, + catppuccin-accent, + }: + final.callPackage ./noctalia-shell { + noctalia-shell = final.noctalia-shell; + inherit catppuccin-flavor catppuccin-accent; + }; + linuxPackages_asahi = prev.linuxPackages_asahi.override { _kernelPatches = [ {