by sshine · 6mo ago · 0 comments
In Claude I use /branch and /rename a lot (context checkpoints, fork, go back)
I use sandboxing almost exclusively: https://github.com/nix-tools/bubblebox -- it's a generalisation of Numtide's claudebox with a few fixes and some feature additions (more coming). This is best compared to always running your Claude in Docker containers, except there's no Docker runtime. Works fine in WSL and nix-darwin, too.
Though I also use nix to manage my machines :-D
How does fnox compare to sops?
How does hk compare to lefthook?
And does hk and fnox have a similar Nix integration as lefthook-nix and sops-nix?
I'm still hoping I don't need to make a better lefthook.
I kind of like sops-nix, not sure what's missing, really. Maybe fnox is similarly wholesome for non-Nix users.
I see that hk has a flake, so that's a good sign.
1. All .nix files (besides flake.nix) are flake-parts modules: https://flake.parts/
2. It's not only usable with experimental flakes. Works fine with unflake or trix.
The experimental part of flakes is enabling flake support in the `nix` CLI.
Flakes are also a design pattern in pure Nix syntax that can be evaluated fine without the experimental flag.
If you're curious about this meaningful organization, it's pretty well-documented:
As for the experimental nature of flakes, it's more of a social experiment by now:
https://simonshine.dk/articles/if-flakes-are-experimental-wh...
Codex is way better at nix than I am.
I use NixOS on my self-hosted CI runners, and I generate the OCI image using Nix via pkgs.dockerTools:
https://git.shine.town/infra/runners/src/branch/main/nix/nix...
It has nothing to do with Docker as such, it's just named that.
https://nix.dev/tutorials/nixos/building-and-running-docker-...
Guess I need to try out dockerTools. That looks really convenient. Thanks!
On my own machine I just give it a Linux User Namespace, i.e. soft virtualisation via "bubblewrap."
What Docker Compose and Linux User Namespaces provide that a VPS doesn't: You can easily mount extra directories from your developer host machine in read or read+write mode. With the VPS you (most likely) need it to clone all of your resources separately, which requires SSH keys, and now you're slowly building towards an independent agentic environment, which is definitely very nice, but time-consuming, compared to piggybacking on your developer environment. Definitely the direction I'm going.
I have a project that's mostly Rust sprinkled with C++ libs and Python helpers and it's easier to manage than the average virtualenv. Everything builds with nix build, everything runs with nix run, profiler/debugger works, IDE detects everything on any of my computers, builds and links with CUDA on x86, aarch64, NixOS, MacOS, Ubuntu or Amazon Linux. nix build can even build a Docker image for the odd need of Docker, and I haven't tried but I'm convinced that if I import the flake on my nix-config it will be built into the SD card for my Raspberry Pi just fine.
It's even replaced Ansible for me, colmena all the way.
I'm not a Python developer, but I follow the news, and I agree that uv is the future of Python package management.
So if you're a Nix user and you want Nix to be opt-in, and you love uv, you use uv2nix, declare the uv lock file the source of truth and build your Nix derivations on that. When the hashpins live in the uv lock file, uv works just fine, but uv2nix produces derivations that are cached and can be embedded in CI or deployment strategies.
So... running CI on your uv-based project means your Nix tooling can cache both tooling and dependencies.
And... deploying your uv-based project you can build an OCI image with the same source of truth as the dev/CI environments.
This matters more for toolchains that YOLO more wrt. dependency pinning: Does that CLI call in your Dockerfile really pull the same thing down just because it's still v6.6.6? Some package managers provide a lot of sane choices, and I'd bet uv is one of them. But your Dockerfile is always a second-grade citizen unless you re-use the same base as a devcontainer.
Maybe you have some premade tooling that helps provide persistency between container invocations.
But by default, closing your agent container and opening it again just wipes everything you didn't host-mount.
What I'm advocating is really just the same functionality without the Docker runtime, because Linux has namespaces.
Feels more like you're on your host system with exactly the minor variations you specify.
Making Docker feel like your host system is possible, but I just never felt at home.