Skip to content

daemon: use per-store state directory for socket path #15190

Open
amaanq wants to merge 1 commit intoNixOS:masterfrom
obsidiansystems:per-store-socket-path
Open

daemon: use per-store state directory for socket path #15190
amaanq wants to merge 1 commit intoNixOS:masterfrom
obsidiansystems:per-store-socket-path

Conversation

@amaanq
Copy link
Member

@amaanq amaanq commented Feb 10, 2026

Motivation

This commit makes the daemon socket path derive from the store's stateDir instead of the global nixDaemonSocketFile, so nix daemon --store /foo/bar serves from a socket under that store's state directory. The UDS remote store client likewise resolves its default socket path from its own stateDir. NIX_DAEMON_SOCKET_PATH still takes priority everywhere.

Context

This addresses #15189.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store labels Feb 10, 2026
@amaanq amaanq changed the title Make nix daemon a StoreConfigCommand daemon: use per-store state directory for socket path Feb 10, 2026
@amaanq amaanq force-pushed the per-store-socket-path branch 2 times, most recently from 5fefd3b to 0e4b44e Compare February 10, 2026 21:51
Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get rid of nixDaemonSocketFile entirely, per the issue. It will force us to recon with everything that is going on.

@amaanq amaanq force-pushed the per-store-socket-path branch 4 times, most recently from 62fecc6 to cebafde Compare February 11, 2026 20:42
@amaanq amaanq force-pushed the per-store-socket-path branch from cebafde to 559c051 Compare February 23, 2026 16:14
@amaanq amaanq force-pushed the per-store-socket-path branch 4 times, most recently from f3bba5c to eb7d3c3 Compare March 9, 2026 22:49
@amaanq amaanq force-pushed the per-store-socket-path branch 2 times, most recently from 855c772 to e01f00b Compare March 9, 2026 22:53
@Ericson2314 Ericson2314 force-pushed the per-store-socket-path branch 2 times, most recently from 48fe17b to 856dece Compare March 10, 2026 00:10
@Ericson2314 Ericson2314 force-pushed the per-store-socket-path branch from 856dece to 06f90b8 Compare March 10, 2026 00:19
@amaanq amaanq force-pushed the per-store-socket-path branch 4 times, most recently from ad3914c to 5a341ee Compare March 10, 2026 20:36
@Ericson2314 Ericson2314 force-pushed the per-store-socket-path branch 2 times, most recently from 899df94 to d1afb08 Compare March 11, 2026 01:41
- `nixDaemonSocketFile` and `nixLogDir` are gone. Instead we have
  `getStateDir` and `getLogDir` functions on `Store::Config`, which are
  overridden by `LocalFSStore::Config`. This matches the same pattern
  that was done for `Store::Config::getReadOnly` --- the functions are
  introduced initially with global settings, and then overridden to take
  into account store-specific settings for the stores which have those
  settings.

- `getDaemonSocketPath` is a new free-standing function because it does
  not vary except for with respect to the state dir, which we aleady
  have `getStateDir` for. It is used to default the socket path for the
  client (`UdsRemoteStore::Config`) and the server (`nix-daemon` / `nix
  daemon`).

- This commit, beyond being a refactor reducing global variables, does
  intentionally change behavior. The behavior change is described in eh
  release note.

Fix NixOS#15189
@Ericson2314 Ericson2314 force-pushed the per-store-socket-path branch from d1afb08 to e786ac5 Compare March 11, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants