Catppuccin-nix: the soothing pastel theme, but for nix!

I got a dumb question.

Could catppuccin-nix have been made using GitHub - danth/stylix: System-wide colorscheming and typography for NixOS so other “theme packs” could share the same modules for each apps?

Perhaps but why would we want to duplicate the effort made by other contributors, thats why we use nvfetcher to get the latest version of said themes and load them into modules are the appropriate locations.

2 Likes

I was not able to enable it on Fish. Do you ?

I wrote the fish module, and it seems to work for me.

Do you mind sharing your config?

Here’s the merge request that tries to add it: Draft: catpuccin: add to profile (!5) · Merge requests · ECPHP / Devs profile · GitLab

When building the VM to test the light profile:

nix build .#nixosConfigurations.light.config.formats.vm -L --impure

I get this issue:

❯ nix build .#nixosConfigurations.light.config.formats.vm -L --impure
error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'nixos-vm'
         whose name attribute is located at /nix/store/qjgi80svyhfcwbnlvzzaqg0nyr7h2w59-source/pkgs/stdenv/generic/make-derivation.nix:331:7

       … while evaluating attribute 'buildCommand' of derivation 'nixos-vm'

         at /nix/store/qjgi80svyhfcwbnlvzzaqg0nyr7h2w59-source/pkgs/build-support/trivial-builders/default.nix:68:16:

           67|         enableParallelBuilding = true;
           68|         inherit buildCommand name;
             |                ^
           69|         passAsFile = [ "buildCommand" ]

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: The option `home-manager.users.admin.programs.fish.catpuccin' does not exist. Definition values:
       - In `/nix/store/4w0hgfghvlvwx7bzaqh215jkgwbfkscw-source/profiles/light/shell.nix':
           {
             enable = true;
           }

This project was announced on the Nix Foundation’s social channels on April 9, 2024.
mastodon
linkedin
x/twitter

looks like a typo to me, at this position Draft: catpuccin: add to profile (!5) · Merge requests · ECPHP / Devs profile · GitLab

fish = {
-     catpuccin.enable = true;
+     catppuccin.enable = true;
      enable = true;
};
1 Like

Thank you… I missed it.

1 Like

To enable catppuccin globally, I made a simple Home Manager module, with the help of @R-VdP !

{ lib
, config
, inputs
, options
, ...
}:

let
  cfg = config.catppuccin-global;
in
{
  imports = [
    inputs.catppuccin.homeManagerModules.catppuccin
  ];

  options.catppuccin-global = {
    enable = lib.mkEnableOption "Enable Catppuccin globally";
    flavour = lib.mkOption {
      type = lib.types.enum [ "latte" "frappe" "macchiato" "mocha" ];
      default = "mocha";
    };
  };

  config.programs = lib.mkIf cfg.enable (
    lib.foldlAttrs
      (programs: name: value:
        programs // (lib.optionalAttrs (lib.hasAttr "catppuccin" value) { ${name}.catppuccin = {enable = true; flavour = lib.mkDefault cfg.flavour;}; })
      )
      { }
      options.programs
  );
}
1 Like

Could this logic be upstreamed as a response to Add global `enableAll` setting · Issue #115 · catppuccin/nix · GitHub?

Yes, I might probably do a pull request in the evening.

1 Like

Here we go: feat: add `home-manager` module by drupol · Pull Request #124 · catppuccin/nix · GitHub

I haven’t tested it yet

It would be really cool if the home-manager module could also have qt support via kvantum or something similar. It’s a bit jarring to have all my apps using catppuccin and then I open a qt app and it’s blinding white. I’m trying to do it on my own, but it doesn’t seem to be working. I have this as one of my home-manager modules:

{ config, pkgs, ... }:
  qt = {
    enable = true;
    platformTheme.name = "qtct";
    style.name = "kvantum";
  };

  home.packages = with pkgs; [
    (catppuccin-kvantum.override {
      variant = "Mocha";
      accent = "Blue";
    })
  ];
#  xdg.configFile."Kvantum/kvantum.kvconfig".source =
#    (pkgs.formats.ini {}).generate "kvantum.kvconfig" {
#      General.theme = "Catppuccin-Mocha-Blue";
#    };
}

This gives me both kvantummanager and kvantumpreview on my $PATH, and while kvantum comes with a large number of themes by default, my overrides don’t seem to be adding the catpuccin themes in the way they should.

There’s probably a way I can cut out the middle step of using the derivation from nixpkgs and just downloading the required themes straight from github, but I’m not sure.

The part at the end, which is currently commented out, is supposed to set the default kvantum theme to my desired catpuccin theme, but that’s not going to work if I can’t even find the theme via kvantummanager.

I have the same configuration as you and I see the theme in Kvantum Manager. Try checking if it exists under one of the following paths:

  • ~/.nix-profile/share/Kvantum/
    or
  • /etc/profiles/per-user/<user>/share/Kvantum

If it’s there, maybe you should reboot your machine. I found out that rebooting is probably always necessary after messing with themes.

I can’t actually find it there. I have home-manager managed through the NixOS module, so all the generated files go in /etc/profiles/per-user/avi/share/ But the only folders starting with K in there are kservices5/, kservicetypes5/, and kxmlgui5/. And yes, I have rebooted after making these changes.

This is how kvantum is currently installed for me:

  home.packages = with pkgs; [
    (catppuccin-kvantum.override {
      accent = "Blue";
      variant = "Macchiato";
    })
    libsForQt5.qtstyleplugin-kvantum
    libsForQt5.qt5ct
  ];

Then I just set kvantum as the theme in qt5ct and qt6ct, which you can either do manually or using home-manager:

You can try doing that for starters and see if that works and what’s different from what you have now.

That being said, this is the thought process I have regarding why you couldn’t find it:

  • How is kvantum currently installed?
  • Does installing it with NixOS vs home-manager make a difference?
  • Is there a difference between installing the qt5 or qt6 versions of kvantum?
  • Can you confirm that home-manager is indeed managed by NixOS? (maybe by checking another package)

I don’t have qt5ct or qt6ct installed. Should I be using those over kvantum? I also don’t know how to get different versions of kvantum. Also, theme.nix is listed in home-manager.nixosModules.home-manager.modules

You have qt.platformTheme="qtct", so yes you need to have them installed. You have other options if you prefer those instead.

It’s just different packages. For NixOS 23.11 there is:

  • libsForQt5.qtstyleplugin-kvantum
  • qt6Packages.qtstyleplugin-kvantum

For NixOS unstable:

  • libsForQt5.qtstyleplugin-kvantum
  • kdePackages.qtstyleplugin-kvantum

This might not have any difference, however.

Did you try putting the contents of theme.nix in the main home.nix? It might not be imported properly. I have everything in one file, so I’m not sure if this is how to do this, but you can try putting it in home-manager.users.user.imports.

Can you just show me what you’re doing to get catppuccin themes in qt, so that I can copy off of you?

Sure, this is what I have:

NixOS module
            inputs.home-manager.nixosModules.home-manager
            {
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;
              home-manager.users.<user>.imports = [
                ./hosts/default/home.nix
                inputs.catppuccin.homeManagerModules.catppuccin #for other packages
              ];
              home-manager.extraSpecialArgs = { inherit inputs; };
            }
Inside "./hosts/default/home.nix"
  home.packages = with pkgs; [
    (catppuccin-kvantum.override {
      accent = "Blue";
      variant = "Macchiato";
    })
    libsForQt5.qtstyleplugin-kvantum
    libsForQt5.qt5ct
  ];

  qt = {
    enable = true;
    platformTheme = "qtct";
    style.name = "kvantum";
  };

  xdg.configFile."Kvantum/kvantum.kvconfig".source = (pkgs.formats.ini { }).generate "kvantum.kvconfig" {
    General.theme = "Catppuccin-Macchiato-Blue";
  };

Then in qt5ct and qt6ct I manually set kvantum as the theme. That’s it.

Also, I think it might be better if we moved this to a separate issue as it’s not related to catppuccin-nix.

1 Like