Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql fails to install: derivation contains an illegal reference specifier 'man' #369366

Closed
suhr opened this issue Dec 30, 2024 · 2 comments
Closed
Labels
0.kind: bug Something is broken

Comments

@suhr
Copy link
Contributor

suhr commented Dec 30, 2024

Describe the bug

# nixos-rebuild switch
evaluation warning: nur.overlay has been replaced by nur.overlays.default
building the system configuration...
evaluation warning: nur.overlay has been replaced by nur.overlays.default
evaluation warning: The option `services.samba.shares' defined in `/nix/store/0lwkq1aw821kd528p4sii8f6ym4bghs4-source/samba.nix' has been renamed to `services.samba.settings'.
evaluation warning: taskwarrior was replaced by taskwarrior3, which requires manual transition from taskwarrior 2.6, read upstream's docs: https://taskwarrior.org/docs/upgrade-3/
[1/1/17 built] building postgresql-14.15 (installCheckPhase): ok          290 m       cconflict ... ok          417 ms

error: derivation contains an illegal reference specifier 'man'
error: 1 dependencies of derivation '/nix/store/2as4zxz8bgfcplra5ghikmywk8rlr41d-postgresql-and-plugins-14.15.drv' failed to build
error: 1 dependencies of derivation '/nix/store/nczdanlvm837k32xkdi75wiafdyzlpl1-postgresql-configfile-check.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wnc4x8kb45fdac454zbwap636npx016m-nixos-system-nixos-25.05.20241229.88195a9.drv' failed to build

Additional context

services.postgresql = {
    enable = true;
    package = pkgs.postgresql_14;
    extensions = (p: [p.pgvector]);
    # ...
}

Metadata

  • system: "x86_64-linux"
  • host os: Linux 6.11.6, NixOS, 25.05 (Warbler), 25.05.20241229.88195a9
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.25.3
  • channels(root): "nixos"
  • channels(suhr): ""
  • nixpkgs: /nix/store/zq2axpgzd5kykk1v446rkffj3bxa2m2h-source

Notify maintainers

@thoughtpolice @danbst @globin @ivan @Ma27 @wolfgangwalther


Note for maintainers: Please tag this issue in your PR.


Add a 👍 reaction to issues you find important.

@suhr suhr added the 0.kind: bug Something is broken label Dec 30, 2024
@wolfgangwalther
Copy link
Contributor

This seems to be a nix bug, see #368091.

@wolfgangwalther
Copy link
Contributor

#368091 is merged, should be fixed.

lf- pushed a commit to lix-project/lix that referenced this issue Jan 12, 2025
Nixpkgs issues / PRs:
* NixOS/nixpkgs#368091
* NixOS/nixpkgs#369366

This can be triggered with the postgresql_14 derivation from nixpkgs rev
19305d94dacca226ca048b78e6de00f599c65858
(/nix/store/bxp6g57limvwiga61vdlyvhy7i8rp6wd-postgresql-14.15.drv on
x86_64-linux): for reasons unknown to me, only the `man` and `lib` outputs
are cached on cache.nixos.org:

    $ nix derivation show  /nix/store/bxp6g57limvwiga61vdlyvhy7i8rp6wd-postgresql-14.15.drv | jq '.[].outputs.[].path' -r | xargs nix path-info --store https://cache.nixos.org
    warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/bxp6g57limvwiga61vdlyvhy7i8rp6wd-postgresql-14.15.drv^*'
    don't know how to build these paths:
      /nix/store/m9vb40xxr6gckjzpfxnqcmjqsks2gx03-postgresql-14.15
      /nix/store/nm1415wa53iawar9axwxy0an6ximhayn-postgresql-14.15-dev
      /nix/store/v9vrvfhiw9gk8hj9895sb15fxvxnyylj-postgresql-14.15-debug
      /nix/store/zi12g1p99g2173i8093ixbqkfh9ng87b-postgresql-14.15-doc
    /nix/store/3i3fpz0xss9inampf51gp3pkx24ypxpj-postgresql-14.15-man
    /nix/store/db8797h2cp4rm1cnsqrf87apkkxwwdff-postgresql-14.15-lib
    error: path '/nix/store/m9vb40xxr6gckjzpfxnqcmjqsks2gx03-postgresql-14.15' does not exist in the store

Also, the derivation uses the `outputChecks` feature (and thus `__structuredAttrs`)
to make sure that e.g. the `out` output doesn't reference the `man`
output:

    __structuredAttrs = true;
    outputs = [ "out" "dev" "doc" "lib" "man" ];
    outputChecks.out.disallowedReferences = [ "dev" "doc" "man" ];

With all that in place, the following error was hit on all CppNix / Lix
versions currently supported when trying to build the derivation above:

    error: derivation contains an illegal reference specifier 'man'

The following happened here:

* The `man` & `lib` outputs were substituted at some point.
* When register outputs, the reference checks are made.
* `LocalDerivationGoal::checkOutputs` gets a map of all outputs that
  were built and are NOT already registered in the store. In the example
  above this means `out`, `dev`, `debug` and `doc`.
* `checkOutputs` tries to resolve the `man` output and fails to do so
  because it's a store-path that's already registered and thus not part
  of the map passed to `checkOutputs`.

Since the map passed to `checkOutputs` is used in various other places
that appear to assume that the paths aren't registered already, I didn't
write the already registered paths into it. Instead, I created a second
map that contains all already registered outputs and pass it as third
argument to `checkOutputs`. If the other lookups fail, this map will be
now checked before the "illegal reference specifier"-error is thrown.

This fixes the problem with `postgresql_14` for me.

Also wrote a small regression test that fails locally without the patch
in place.

Change-Id: Ieacca80c001fcfbebf6f5fe97e25c49d2724c3ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

2 participants