nix3-store-roots-daemon(1)

πŸ“¦ version 2.35.3, in fedora 44

πŸ’– nix3-store-roots-daemon(1) πŸ’–

okay bestie, so this one lives in the General Commands Manual and honestly? it's a whole vibe. it's a manual page for the nix command suite, and before we even get into it:

⚠️ Warning β€” this program is experimental and its interface is subject to change. no cap. it might get a glow-up without warning you. πŸ™ˆ

✨ NAME ✨

nix store roots-daemon β€” run a daemon that returns garbage collector roots on request πŸŽ€


πŸ“œ SYNOPSIS πŸ“œ

nix store roots-daemon [option…]

🌸 EXAMPLES 🌸

  • run the daemon, that's it, that's the whole job:
# nix store roots-daemon

πŸ’… DESCRIPTION πŸ’…

so this command runs a daemon that serves garbage collector roots from a Unix domain socket. it's not required in all Nix installations, but it's genuinely so useful when the main Nix daemon isn't running as root β€” because then it literally can't find runtime roots by scanning /proc. πŸ’€

when the garbage collector runs with use-roots-daemon enabled, it connects to this daemon to discover additional roots that should not be collected. protecting the girlies. 🫢

the daemon listens on <state-dir>/gc-roots-socket/socket β€” typically /nix/var/nix/gc-roots-socket/socket. iykyk. 🌈


πŸ”Œ PROTOCOL πŸ”Œ

the protocol is simple, like uncomplicated-relationship simple. for each client-initiated Unix socket connection, the server:

  1. sends zero or more store paths as NUL-terminated (\0) strings.
  2. closes the connection.

example (with \0 shown as newlines for clarity):

/nix/store/s66mzxpvicwk07gjbjfw9izjfa797vsw-hello-2.12.1
/nix/store/fvpr7x8l3illdnziggvkhdpf6vikg65w-git-2.44.0

πŸ”’ SECURITY πŸ”’

okay so, real talk, this part matters. πŸ”₯

No information is provided as to which processes are opening which store paths. so yeah. however β€” while only the main Nix daemon needs to use this daemon, any user able to talk to the main Nix daemon can already obtain the same information with nix-store --gc --print-roots.

therefore, restricting this daemon to only accept the Nix daemon as a client is, while recommended for defense-in-depth reasons, strictly speaking not reducing what information can be extracted β€” versus merely restricting this daemon to accept connections from any allowed user. the way that changes literally nothing information-wise is wild. 😭


🧚 SYSTEMD SOCKET ACTIVATION 🧚

nix store roots-daemon supports systemd socket-based activation, just like nix daemon. slay, consistency. ✨


βš™οΈ OPTIONS βš™οΈ

  • --debug β€” set the logging verbosity level to debug. we're nosy today, and that's valid. πŸ‘€
  • --log-format format β€” set the format of log output; one of raw, internal-json, bar or bar-with-logs.
  • --print-build-logs / -L β€” print full build logs on standard error.
  • --quiet β€” decrease the logging verbosity level. shhh. 🀫
  • --verbose / -v β€” increase the logging verbosity level. tell me EVERYTHING. πŸ—£οΈ

πŸŽ€ Miscellaneous global options

  • --help β€” show usage information.
  • --offline β€” disable substituters and consider all previously downloaded files up-to-date.
  • --option name value β€” set the Nix configuration setting name to value (overriding nix.conf).
  • --refresh β€” consider all previously downloaded files out-of-date.
  • --version β€” show version information.
πŸ“Œ Note β€” see man nix.conf for overriding configuration settings with command line flags. go read it, bestie, i believe in you πŸ’œ

and that's the page!! πŸŽ€ it was served fresh from nix3-store-roots-daemon(1), General Commands Manual, version and date included, no cap. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from