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

this is a project i’ve been working on for a few months now with some amazing people, and it has now been picked up by the official catppuccin org!

using nixos and home-manager modules, the goal here is to eventually allow each catppuccin port (and there are many) to be easily enabled and configured. so far, we have added support for two dozen ports with more on the way. i hope you all enjoy :slight_smile:

30 Likes

awesome! I have a file in my config full of catppuccin theming, I’ll have to see if any of them need to be added.

2 Likes

Amazing! This is so neat. Would love to see this replicated for other colorschemes!

Brilliant. Thank you so much for pulling this together!

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)