Unable to enable `auto-allocate-uids`

Hi!

I’m trying to enable auto-allocate-uids on my NixOS 26.05 system to be able to run the simple-containers NixOS test. If I enable this in my config:

      nix.settings = {
        extra-system-features = [ "uid-range" ];

        experimental-features = [
          "auto-allocate-uids"
          "cgroups"
        ];
      };

I get a working system, but executing the test gives me:

$ nix-build -A nixosTests.simple-container
this derivation will be built:
  /nix/store/zabp6n0hd377qgs27w4564smj5as59p4-container-test-run-simple-container.drv
error: feature 'uid-range' requires the setting 'auto-allocate-uids' to be enabled

But if I set nix.settings.auto-allocate-uids = true;, I can’t build my NixOS configuration, because the Nix config check fails:

ERROR   stderr) Validating generated nix.conf
ERROR   stderr) error: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
ERROR   stderr) error: builder for '/nix/store/pnhyrf65icvinl5921mnqz4ji2qi1pg8-nix.conf.drv' failed with exit code 1;
ERROR   stderr)        last 2 log lines:
ERROR   stderr)        > Validating generated nix.conf
ERROR   stderr)        > error: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
ERROR   stderr)        For full logs, run:
ERROR   stderr)                nix log /nix/store/pnhyrf65icvinl5921mnqz4ji2qi1pg8-nix.conf.drv
ERROR   stderr) error: 1 dependencies of derivation '/nix/store/56r1xis1bfmjjds2qqa5j3ayvbbiddpj-etc.drv' failed to build

If I disable the config check via nix.checkConfig = false; this results in a b0rken Nix daemon that can’t build anything:

error: the build users group 'nixbld' has no members

Any pointers are appreciated!

Have you tried setting both experimental-features and auto-allocate-uids together?

i don’t believe its documented but you also have to set nix.settings.use-cgroups = true; if you wish to use auto-allocate-uids

This config:

    nix = {
      settings = {
        auto-allocate-uids = true;
        use-cgroups = true;

        extra-system-features = [ "uid-range" ];

        experimental-features = [
          "auto-allocate-uids"
          "cgroups"
        ];
      };
    };

triggers:

ERROR   stderr) building '/nix/store/wbrafj26v5s9s42jvyz5fg1g441r0p6d-nix.conf.drv'...
ERROR   stderr) Validating generated nix.conf
ERROR   stderr) error: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
ERROR   stderr) error: builder for '/nix/store/wbrafj26v5s9s42jvyz5fg1g441r0p6d-nix.conf.drv' failed with exit code 1;
ERROR   stderr)        last 2 log lines:
ERROR   stderr)        > Validating generated nix.conf
ERROR   stderr)        > error: Ignoring setting 'auto-allocate-uids' because experimental feature 'auto-allocate-uids' is not enabled
ERROR   stderr)        For full logs, run:
ERROR   stderr)                nix log /nix/store/wbrafj26v5s9s42jvyz5fg1g441r0p6d-nix.conf.drv
ERROR   stderr) error: 1 dependencies of derivation '/nix/store/wds3nxmwsn99sqkf33m7mpk868shfn6n-etc.drv' failed to build
ERROR   stderr) error: 1 dependencies of derivation '/nix/store/509knpsjd8v90av6zgi73ndz0gqj7jyh-X-Restart-Triggers-nix-daemon.drv' failed to build
ERROR   stderr) error: 1 dependencies of derivation '/nix/store/iccsmgpdvk624km6vlb14r8h9vhqpxvl-unit-nix-daemon.service.drv' failed to build

Let me try to build a standalone reproducer.

The standalone reproducer currently doesn’t reproduce it. This system also has the hydra (lix-fork) module enabled. Let me add this as well.

I found the issue. There was a a stray nix.extraOptions setting experimental-features. :person_facepalming:

Thanks everyone!

1 Like