18 October 2023
NixOS hidden packages
Recently I’ve decided to try out Astro as a superb static site generator with support for new and shiny features like View Transitions.
Astro has its own file format .astro
and Astro’s team is so cool that they provide a Language Server for it.
Search party
As someone knee-deep in the NixOS ecosystem, the first thing I did was search for the Astro Language Server on NixOS Search.
However, to my surprise, it was nowhere to be found! I tried my luck with terminal commands nix search astro
and nix-env -qaP astro
, but alas, nothing popped up.
It’s probably not packaged! Not a big deal. So, off I went to the nixpkgs repo to package it up myself. And guess what? It was there all along!
@astrojs/language-server
I found it chilling in pkgs/development/node-packages/node-packages.nix
, ready for some action.
But why on earth did it take me so long to find it?
Why was it so elusive in the first place?
Was the search index taking a stroll?
Nope, the language server had been packaged for months, so that couldn’t be it.
Why is it missing?!
There are @
and /
in the name.
Well, that’s unusual!
It reminded me of a similar hiccup I had with the tailwind language server on a previous NixOS adventure.
nixpkgs issue: Package request: @tailwindcss/language-server.
It’s a package request for something that was already packaged.
I’m not the only one to miss a Node package in this search conundrum.
The search seems to be broken.
There are no packages that have @
in their names.
I went through the Astro Language Server file of origin:
cat pkgs/development/node-packages/node-packages.json | grep '@'
"@angular/cli"
, "@antfu/ni"
, "@astrojs/language-server"
, "@babel/cli"
, "@commitlint/cli"
, "@commitlint/config-conventional"
, "@microsoft/rush"
, "@shopify/cli"
, "@tailwindcss/aspect-ratio"
, "@tailwindcss/forms"
, "@tailwindcss/language-server"
, "@tailwindcss/line-clamp"
, "@tailwindcss/typography"
, "@uppy/companion"
, "@volar/vue-language-server"
, "@vue/cli"
, {"@webassemblyjs/cli": "1.11.1"}
, {"@webassemblyjs/repl": "1.11.1"}
, "@webassemblyjs/wasm-strip"
, {"@webassemblyjs/wasm-text-gen": "1.11.1"}
, {"@webassemblyjs/wast-refmt": "1.11.1"}
, "@electron-forge/cli"
, "@gitbeaker/cli"
, "@prisma/language-server"
, "@withgraphite/graphite-cli"
, "@yaegassy/coc-nginx"
, "@zwave-js/server"
At least 27 packages are not shown in the search. Doesn’t look too user-friendly, right?
Rescue party
I would like to say that the NixOS community is here to save the day.
There is a nixos-search issue discussing this exact problem.
Unfortunately, it’s from March 2021 and stale for more than two years.
A little crawling from this issue brings me to a “good package name” regex [A-Za-z_][A-Za-z0-9-_+]*
.
So there might be even more non-searchable packages.
I’ve successfully searched for packages that don’t fit this regex, though 🤷🏻♂
Nix is 💙
I have very warm feelings for NixOS, and I want to see it soar to new heights. I’m passionate about Nix, NixOS and what’s possible with them. It is my daily driver on two laptops, a desktop and even SteamDeck. There are more than 80 000 searchable packages which put NixOS in front of many other if not all Linux distributions.
Road ahead
I’ve been using NixOS for over a year now and I still feel like an idiot almost every time I need to configure any of my systems. It feels unnecessarily complicated. Broken search, lacking documentation, and being left with the freedom to implement things however you like make it not a welcoming environment. I want NixOS to be more welcoming. I want it to be as accessible as possible.
It’s just the beginning of my NixOS chronicles. My best bud is hopping on this bandwagon too, and together, we aim to dive deep into the NixOS waters. We’re already getting into Pull Requests, Issues, and documentation.
While I’m still not competent enough to fix NixOS issues myself, I’m going to be vocal about any roadblocks I stumble upon. I hope to become a useful and helpful member of the Nix community one day. I encourage you to join and make NixOS an even better place together! Participating in opened issues from this blog post is a good start.
Stay tuned, more NixOS adventures incoming =]