catppuccin / vscode

🦌 Soothing pastel theme for VSCode & Azure Data Studio

Home Page:https://marketplace.visualstudio.com/items?itemName=Catppuccin.catppuccin-vsc-pack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve the Nix build

nekowinston opened this issue · comments

The current way the Nix build works has some problems and inefficiencies.

Lots of unnecessary dependencies, such as storybook.

I meant to set up a monorepo for this exact reason, and yarn v4 adds some nice improvements for workspaces, so this might be possible soon? stephank/yarn-plugin-nixify#63 tracks the monorepo support for our Nix builder.

Overriding breaks the cache

Using pkgs.catppuccin-vsc.override {} will invalidate the build, and prompt a rebuild from source.

Since using our flake pretty much only makes sense when you intend to utilize overrides, it would make sense to enhance this.
My initial idea: expose the generateThemes hook as plain, bundled JavaScript, so the build can be shared and cached. That hook would have to be called on top of the existing package when overrides are applied, recompiling the theme inside /nix/store.
We'd probably have to have an initial builder for the bundled JS, that deals with pulling in all the devDependencies, then a builder that just runs the bundle to generate the VSCode Extension.

This has been implemented in #221.

Cachix

I tried to add cachix support in #215, but the builds are just taking too long, and it's over-saturating the CI cache. I would probably keep it if overriding didn't invalidate the cache, but right now no one gains from having this as part of our CI. I'll open another PR to temporarily disable it


The Nix support, as it stands right now, is pretty much just a proof of "hey, we can do this fully declaratively", which is neat, but I'd love for it to actually make sense to use as a daily driver. I personally don't use it since I pretty much always have a development version installed.
This issue exists so that anyone who wants to see this improved knows where to get started.

#243 reduces the necessary dependencies for a successful compile:

Result for yarn install:

> du -sh ./node_modules
551M    ./node_modules
> ls -l node_modules | wc -l
738

Result for yarn workspaces focus catppuccin-vsc:

> du -sh ./node_modules
269M    ./node_modules
> ls -l node_modules | wc -l
373

All that's left is figuring out the changes necessary over on https://github.com/stephank/yarn-plugin-nixify to generate the focused .nix output.

However, I've since considered to just download a precompiled JS package, then unzipping that to re-generate the ./themes/ directory. 🤔
This would mean that the flake would no longer build from HEAD, but download CI builds instead. I don't know if that would be a worthwhile tradeoff.

#305 makes Nix builds much faster 🚀
Think I'll consider this closed for now, since the CI builds are passing within 1 minute now, which means pushing to our Cachix has a lot less friction now.