blog

Micro V

(GO HOME)

Created On: Thu, 26th March 14:25 (2026)

for context to all of this, I just spent over 5 hours trying to run some tests in Ruby. researching everywhere, trying god knows how many things - and getting headaches. the main issue is made from 2 things that, together, mess everything up.

  1. Each module uses typhoeus. This requires a shared library - libcurl.so.4.
  2. The tests are in their own module, testing multiple other modules. As such, it has local dependencies.

Problem I means that I can’t just run the tests normally like I would on any other system, since the gems aren’t aware of the Nix context, and thus can’t access the actual shared library. So instead I need to use this thing called bundix. Normally it should work nicely, you just do bundix -l which will setup the lockfile based on your dependencies, and then generate a gemset.nix which can then be used in a default.nix to create a shell in which you can finally run your tests.

Also, the default.nix looks like this:

with (import <nixpkgs> {});
let
gems = bundlerEnv {
name = "your-package";
inherit ruby;
gemdir = ./.;
};
in
mkShell {
packages = [
gems
gems.wrappedRuby
];
}

Problem II however breaks this whole thing. Because when I try to run tests, it complains that it can’t find any of the local dependencies in /nix/store. You’d think there’d be a way to go around this, but with hours of research I literally couldn’t get anywhere. I tried everything too, using nix-ld to link the library didn’t work, using extraConfigPaths didn’t work because it didn’t put the modules where I needed them to be, using ruby-nix didn’t work because it uses a fork of bundix that breaks whenever I try to run it.

You know what did work? A script. One that

  1. Ensures bundix is installed.
  2. Backs up the Gemfile.
  3. Gets the parent directory.
  4. Escapes it. So for example /home/user becomes \/home\/user.
  5. Uses sed to turn each relative path in the Gemfile into an absolute one using the parent directory.
  6. Removes the gemset.nix and Gemfile.lock to make sure everything is up to date.
  7. Regenerate them using bundix -l.
  8. Enters the shell.
  9. On exit, restores the Gemfile.

…and finally, it works. It’s a hack, yeah. But I tried to find the right approach and couldn’t. Maybe Nix experts know what needs to be done here, but frankly this thing amongst other incidents just tells me that I’m right to not try running NixOS on my main machine, because I’ll only end up pissing myself off. On normal distros all I literally need to do is just use bundler.

I can see the benefits. They’re pretty obvious. But when you consider the fact that there’s incomprehensibly more resources on normal distros than there are on Nix - even if the amount of resources available to Nix is pretty cool, it becomes a massive pain. Things that should be normal become a nightmare.

Maybe I’ll want to use it in like, 25 years or so. But for now, no thanks.

P.S. yes, you can probably study up on Nix, like using flakes or home-manager or strategies --- but frankly if your distro needs a manual for me to do half of the things that are trivial on a normal system, I’m out. If I wanted a challenge I would’ve just used Gentoo.