8000 huggorm: a server in its own user namespace over an overlay store · Issue #1060 · nixidae/nixidae · GitHub
[go: up one dir, main page]

Skip to content

huggorm: a server in its own user namespace over an overlay store #1060

Open

Description

@Lillecarl

pynix build --namespaced runs on nanopynix's worker in a user namespace (#1051). User chose (2026-10-24) that huggorm owns this: the server enters the namespace, and pynix connects to it.

Design:

  • huggorm.namespace (stdlib only): the overlay layout (upper, work, state, log under one root; lower-store, lower-dir), its local-overlay:// URI (lower-store, upper-layer, state, log from local-overlay-store.hh 2.34), and enter_overlay_namespace (unshare USER|NS, uid/gid map to 0, / rprivate, overlay userxattr). Ported from nanopynix/namespace.py, without pydantic.
  • huggorm.server --overlay ROOT [--lower-store URI --lower-dir DIR]: enters the namespace in main(), before anyio.run. It enables local-overlay-store and sets build-users-group = "" and require-drop-supplementary-groups = false.
  • --load-config: the server reads no nix.conf today. nanopynix's worker did, and sandbox-paths and NIX_CONFIG depend on it.
  • AsyncRemoteSession gains forward, forward_process and capture_process, as the local session has.

Measured: one OS thread (/proc/self/task) after import huggorm_bindings and import huggorm.server. So main() can unshare with no exec.

No forkserver probe: the server is a subprocess, and its stderr carries the reason it failed.

Refs #1051


Assisted-By: Claude Opus 5.5

Activity

  1. added
    source: huggorm
    on Oct 24, 2026
  2. Lillecarl commented on Oct 24, 2026

    @Lillecarl
    ContributorAuthor

    Server half measured (huggorm.namespace, huggorm.server --overlay ROOT --load-config). A build in the overlay lands in ROOT/upper and not in /nix/store (tests/test_namespace.py, nix_2_35 lane).

    The settings that --overlay forces. Each was proven by overriding it with --option with the host's nix.conf loaded:

    setting error when broken
    build-users-group = "" changing ownership of "/nix/store": Invalid argument
    require-drop-supplementary-groups = false setgroups failed
    auto-optimise-store = false hard link from /nix/store/.links/...: Permission denied
    auto-allocate-uids = false opening user lock "/nix/var/nix/userpool2/slot-0": Permission denied
    use-cgroups = false creating cgroup ".../nix-build-pid-...": Permission denied

    nanopynix set only the first two. The other three come from this host's nix.conf, which the server reads only with --load-config.

    A lower layer other than the host store hides the server's own closure. The server then fails its first lazy import: No module named 'anyio._backends'. So --lower-dir must hold the server's closure.

    The nix_2_34 lane cannot build over this host's 2.35.3 daemon: QueryRealisation is refused (#1061). The test skips there and gives that reason.


    Assisted-By: Claude Opus 5.5

  3. Lillecarl commented on Oct 24, 2026

    @Lillecarl
    ContributorAuthor

    pynix half measured (pynix/tests/test_build_namespaced.py, Nix 2.35 dev shell: 3 passed):

    • The output stays in ROOT/upper, and the host store has no copy with --no-copy-back.
    • nix.conf's /bin/sh and a --sandbox-path are both mounted. With sandbox-paths in place of extra-sandbox-paths, the builder fails ("builder failed with exit code 1").
    • --copy-back is the default, and the output reaches the daemon.
    • A failed build raises Nix's BuildError itself. Before the NixClient.__aexit__ fix it arrived in the ping loop's ExceptionGroup.

    Found on the way and fixed: python -m huggorm.server printed a runpy RuntimeWarning on every start, into pynix's stderr. spawned() uses -c (#1062 holds the -m entry).

    On the default 2.34 shell the three tests skip: #1061.

    Remaining: remove pynix's other nanopynix pieces (target.py engine parts, the _util sessions, main.py's NixError).


    Assisted-By: Claude Opus 5.5

  4. added 20 commits that reference this issue on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    source: huggorm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0