Nix-housing: live inside a sandbox - better hygiene for your shell

On MacOS, programs - even from the terminal - can’t just access my app data or documents; a permission dialog will pop up. Why can’t I have that in Linux? Why does every git-hook or text-editor extension have access to my documents and images? Why are my browser cookies accessible to every tool I run?

Well I went on a bit of a journey and ended up building nix-housing.

I wrote some blog posts that explain the idea (non-LLM):

Disclaimer:

Non-vibecoded, I wrote the code 90% myself, trying to keep it minimal and simple, with the main exception being wayland-security-context.c which I plan on auditing later.

I’m not a professional security researcher.

18 Likes

Super cool!

@DavHau would be interesting to merge efforts with sbox?

2 Likes

I’d even be happy to ditch sbox all along if something better comes around. I’ve been looking at nix-housing since a while already. I’ve just been to lazy to adjust my workflow to try it out.

nix-housing allows to enforce a stronger separation than sbox. Sbox is designed as an ephemeral sandbox per project directory and doesn’t necessarily protect your normal day-to-day activity. Sbox doesn’t protect your `host` from accidentally executing git hooks that were installed from inside the sandbox, for example, because all the untrusted projects just live in your normal home. It also doesn’t force you to live in isolation by default, vs. with nix-housing you can set your system up in a way that the default terminal is already isolated.

nix-housing seems to offer stronger protection by default, but you have to adjust your way of working around dealing with multiple “houses”, and how to move things between them. I’m looking forward to try it out soon.

2 Likes

I’d also like to mention GitHub - viperML/hover-rs: Protective home overlay · GitHub — I’ve been meaning to do something vaguely similar using hover as a library to do so. I can’t load the Codeberg page but sharing this one just in case it is useful.

2 Likes

*/dev/hidraw0in the post.

1 Like