nix-community / home-manager

Manage a user environment using Nix [maintainer=@rycee]
https://nix-community.github.io/home-manager/
MIT License
6.72k stars 1.76k forks source link

bug: DocBook validation errors on Darwin #4142

Closed takeda closed 1 year ago

takeda commented 1 year ago

Are you following the right branch?

Is there an existing issue for this?

Issue description

I updated nix-darwin, home-manager and nixpkgs and after that it refuses to build due to issues with manpages:

building '/nix/store/grcyxm6s51nxqh8288611x2635wfxlxr-docbook-xsl-ns-1.79.2.drv'...
building '/nix/store/njjcgh3bkc8p0md376m1y00vp7j96yg8-manual-combined.drv'...
unpacking sources
unpacking source archive /nix/store/vq0ifa979q5344vxqr98bqfmspyc85an-docbook-xsl-1.79.2.tar.bz2

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1491: element variablelist: Relax-NG validity error : Did not expect element variablelist there
  1487  </section>
  1488  </chapter>
  1489   <appendix xml:id="ch-options">
  1490    <title>Configuration Options</title>
  1491    <variablelist xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="home-manager-options" xml:base="nmd-result/home-manager-options.xml"><varlistentry><term xlink:href="#opt-_module.args" xml:id="opt-_module.args"><option>_module.args</option></term><listitem><simpara>Additional arguments passed to each module in addition to ones
  1492  like <literal>lib</literal>, <literal>config</literal>,
  1493  and <literal>pkgs</literal>, <literal>modulesPath</literal>.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1491: element varlistentry: Relax-NG validity error : Did not expect element varlistentry there
  1487  </section>
  1488  </chapter>
  1489   <appendix xml:id="ch-options">
  1490    <title>Configuration Options</title>
  1491    <variablelist xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="home-manager-options" xml:base="nmd-result/home-manager-options.xml"><varlistentry><term xlink:href="#opt-_module.args" xml:id="opt-_module.args"><option>_module.args</option></term><listitem><simpara>Additional arguments passed to each module in addition to ones
  1492  like <literal>lib</literal>, <literal>config</literal>,
  1493  and <literal>pkgs</literal>, <literal>modulesPath</literal>.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1491: element varlistentry: Relax-NG validity error : Expecting element example, got varlistentry
  1487  </section>
  1488  </chapter>
  1489   <appendix xml:id="ch-options">
  1490    <title>Configuration Options</title>
  1491    <variablelist xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="home-manager-options" xml:base="nmd-result/home-manager-options.xml"><varlistentry><term xlink:href="#opt-_module.args" xml:id="opt-_module.args"><option>_module.args</option></term><listitem><simpara>Additional arguments passed to each module in addition to ones
  1492  like <literal>lib</literal>, <literal>config</literal>,
  1493  and <literal>pkgs</literal>, <literal>modulesPath</literal>.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1491: element varlistentry: Relax-NG validity error : Expecting element bridgehead, got varlistentry
  1487  </section>
  1488  </chapter>
  1489   <appendix xml:id="ch-options">
  1490    <title>Configuration Options</title>
  1491    <variablelist xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="home-manager-options" xml:base="nmd-result/home-manager-options.xml"><varlistentry><term xlink:href="#opt-_module.args" xml:id="opt-_module.args"><option>_module.args</option></term><listitem><simpara>Additional arguments passed to each module in addition to ones
  1492  like <literal>lib</literal>, <literal>config</literal>,
  1493  and <literal>pkgs</literal>, <literal>modulesPath</literal>.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1504: element listitem: Relax-NG validity error : Did not expect element listitem there
  1500  not bound to an attribute.</simpara>
  1501  <simpara>Some arguments are already passed by default, of which the
  1502  following <emphasis>cannot</emphasis> be changed with this option:</simpara>
  1503  <itemizedlist>
  1504  <listitem><para><simpara><varname>lib</varname>: The nixpkgs library.</simpara>
  1505  </para></listitem>
  1506  <listitem><para><simpara><varname>config</varname>: The results of all options after merging the values from all modules together.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml fails to validate
error: builder for '/nix/store/njjcgh3bkc8p0md376m1y00vp7j96yg8-manual-combined.drv' failed with exit code 3;
       last 10 log lines:
       > /nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1504: element listitem: Relax-NG validity error : Did not expect element listitem there
       >   1500        not bound to an attribute.</simpara>
       >   1501    <simpara>Some arguments are already passed by default, of which the
       >   1502     following <emphasis>cannot</emphasis> be changed with this option:</simpara>
       >   1503    <itemizedlist>
       >   1504  <listitem><para><simpara><varname>lib</varname>: The nixpkgs library.</simpara>
       >   1505 </para></listitem>
       >   1506      <listitem><para><simpara><varname>config</varname>: The results of all options after merging the values from all modules together.</simpara>
       >
       > /nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml fails to validate
       For full logs, run 'nix log /nix/store/njjcgh3bkc8p0md376m1y00vp7j96yg8-manual-combined.drv'.
error: 1 dependencies of derivation '/nix/store/lqxhvymj7bss21lfb5lxw0h3l16l7qck-man-pages.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4a9vr63rd7hgrl0grnq3a88py08qg1s5-home-manager-applications.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wnqi2vb3vfhp29p4v47714s8ybwi9i2l-home-manager-fonts.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3n6911xxzxsfyad4gn15z4lvx9zqp7i7-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rc7g3071nsvla846j11iqcw1f8qbxfrq-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2idk7b5zp12h02dc3iw3fsg8lqbvw60q-activation-dk255056.drv' failed to build
error: 1 dependencies of derivation '/nix/store/7x5v7vx50i6lw12ax73ppvwdh18c0i29-darwin-system-23.11pre496909.3fb3ce0b6b8+darwin4.0000000.drv' failed to build

Here's output of nix log /nix/store/njjcgh3bkc8p0md376m1y00vp7j96yg8-manual-combined.drv

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1491: element variablelist: Relax-NG validity error : Did not expect element variablelist there
  1487  </section>
  1488  </chapter>
  1489   <appendix xml:id="ch-options">
  1490    <title>Configuration Options</title>
  1491    <variablelist xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="home-manager-options" xml:base="nmd-result/home-manager-options.xml"><varlistentry><term xlink:href="#opt-_module.args" xml:id="opt-_module.args"><option>_module.args</option></term><listitem><simpara>Additional arguments passed to each module in addition to ones
  1492  like <literal>lib</literal>, <literal>config</literal>,
  1493  and <literal>pkgs</literal>, <literal>modulesPath</literal>.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1491: element varlistentry: Relax-NG validity error : Did not expect element varlistentry there
  1487  </section>
  1488  </chapter>
  1489   <appendix xml:id="ch-options">
  1490    <title>Configuration Options</title>
  1491    <variablelist xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="home-manager-options" xml:base="nmd-result/home-manager-options.xml"><varlistentry><term xlink:href="#opt-_module.args" xml:id="opt-_module.args"><option>_module.args</option></term><listitem><simpara>Additional arguments passed to each module in addition to ones
  1492  like <literal>lib</literal>, <literal>config</literal>,
  1493  and <literal>pkgs</literal>, <literal>modulesPath</literal>.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1491: element varlistentry: Relax-NG validity error : Expecting element example, got varlistentry
  1487  </section>
  1488  </chapter>
  1489   <appendix xml:id="ch-options">
  1490    <title>Configuration Options</title>
  1491    <variablelist xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="home-manager-options" xml:base="nmd-result/home-manager-options.xml"><varlistentry><term xlink:href="#opt-_module.args" xml:id="opt-_module.args"><option>_module.args</option></term><listitem><simpara>Additional arguments passed to each module in addition to ones
  1492  like <literal>lib</literal>, <literal>config</literal>,
  1493  and <literal>pkgs</literal>, <literal>modulesPath</literal>.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1491: element varlistentry: Relax-NG validity error : Expecting element bridgehead, got varlistentry
  1487  </section>
  1488  </chapter>
  1489   <appendix xml:id="ch-options">
  1490    <title>Configuration Options</title>
  1491    <variablelist xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="home-manager-options" xml:base="nmd-result/home-manager-options.xml"><varlistentry><term xlink:href="#opt-_module.args" xml:id="opt-_module.args"><option>_module.args</option></term><listitem><simpara>Additional arguments passed to each module in addition to ones
  1492  like <literal>lib</literal>, <literal>config</literal>,
  1493  and <literal>pkgs</literal>, <literal>modulesPath</literal>.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml:1504: element listitem: Relax-NG validity error : Did not expect element listitem there
  1500  not bound to an attribute.</simpara>
  1501  <simpara>Some arguments are already passed by default, of which the
  1502  following <emphasis>cannot</emphasis> be changed with this option:</simpara>
  1503  <itemizedlist>
  1504  <listitem><para><simpara><varname>lib</varname>: The nixpkgs library.</simpara>
  1505  </para></listitem>
  1506  <listitem><para><simpara><varname>config</varname>: The results of all options after merging the values from all modules together.</simpara>

/nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml fails to validate

Maintainer CC

No response

System information

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-darwin"`
 - host os: `Darwin 22.4.0, macOS 10.16`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.15.0`
 - channels(root): `"darwin, home-manager, nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
ncfavier commented 1 year ago

You updated to what version? Did you run sudo nix-channel --update? Can you post the output of sudo nix-channel --list?

takeda commented 1 year ago

Yes, I run: sudo -H nix-channel --update

The output is:

darwin https://github.com/LnL7/nix-darwin/archive/master.tar.gz
home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixpkgs https://nixos.org/channels/nixpkgs-unstable
ncfavier commented 1 year ago

cc @pennae, since this class of errors has historically been following nixpkgs changes, and you were de-docbookifying things recently.

pennae commented 1 year ago

the error message from schema validation is (unsurprisingly) not very useful. we'd guess that the actual error as a good distance away in the xml file, would need the file to find out. given that the home-manager docs system is neither fully nixpkgs nor fully its own we're not even sure we can do anything to resolve this

ncfavier commented 1 year ago

My current guess (still investigating) is the change to mdDoc, which is used in a couple places in HM.

ncfavier commented 1 year ago

Couldn't reproduce in CI. :( @takeda could you share the contents of /nix/store/bk13pbmm5lw1nvm1b8xajzbbj4vrsqar-manual-combined/manual-combined.xml?

seh commented 1 year ago

Here's my manual-combined.xml file (in a ZIP archive to satisfy GitHub's file upload restrictions).

takeda commented 1 year ago

Here's my manual-combined.xml.gz

rycee commented 1 year ago

From what I can tell _module.args contains <simpara> inside <para>, which is not allowed. For example

<para><simpara><varname>lib</varname>: The nixpkgs library.</simpara>
</para>

I've seen this before and thought it was fixed. I'll have a look at what has changed. @takeda Meanwhile, could you make certain that you are using an up to date version of Home Manager?

ncfavier commented 1 year ago

It looks like https://github.com/nix-community/home-manager/issues/3680#issuecomment-1441034340 still applies.

ncfavier commented 1 year ago

Finally managed to reproduce this. It happens iff using a post-https://github.com/NixOS/nixpkgs/pull/237557 nixpkgs (so, as of now, any unstable channel) AND mdDoc is still a _type wrapper, which https://github.com/NixOS/nixpkgs/pull/237557 undid but nix-darwin works around here.

ncfavier commented 1 year ago

So the underlying problem is still the same: HM is not ready to properly render _module.args's description, but it was now made visible again.

emilazy commented 1 year ago

Yes, we've also run into this in nix-darwin. I am working on moving nix-darwin over to using the new upstream NixOS options processor and documentation generator; it is quite easy and removes a lot of duplicated code and complexity, and the old DocBook options can be converted to Markdown automatically. Would Home Manager be interested in moving from nmd to that? I am happy to work on this for HM too if so.

ncfavier commented 1 year ago

Yes yes yes yes yes please yes.

emilazy commented 1 year ago

lol, noted :)

I have to finish off nix-darwin first, and Home Manager has an actual manual and not just configuration docs, so it'll probably be a few days. In the meantime I would recommend affected users temporarily disable manual.manpages.enable (and manual.html.enable if you have it on) and look up options in the online copy instead. You can subscribe to this issue to learn when you can toggle it back on.

seh commented 1 year ago

I would recommend affected users temporarily disable manual.manpages.enable

I can confirm that disabling this option in my home.nix file allows me to get past this problem, and on to the next problem.

takeda commented 1 year ago

I've seen this before and thought it was fixed. I'll have a look at what has changed. @takeda Meanwhile, could you make certain that you are using an up to date version of Home Manager?

@rycee I run nix-channel --update and it updated nixpkgs, home-manager, and nix-darwin to whatever was recent at the time I created the ticket.

If there's a way to do a double check it somehow (like maybe I can get the git hash for each channel) then let me know and I check. But those channels should be latest as of yesterday.

ncfavier commented 1 year ago

@takeda it's fine, we've confirmed the bug is with the latest versions.

rycee commented 1 year ago

@takeda Could you try pulling the latest home-manager master now and see if the documentation builds?

hraban commented 1 year ago

@takeda Could you try pulling the latest home-manager master now and see if the documentation builds?

Fwiw it fixed it for me. Thanks.

rycee commented 1 year ago

@hraban Thanks a lot! Would you mind trying it once more? I made a slightly different solution that should be better.

hraban commented 1 year ago

@rycee this version works as well:

    'github:nix-community/home-manager/29872a1c8f5ed2fde270afb0583d1fabce5e0459' (2023-06-24)
  → 'github:nix-community/home-manager/68aebb45de644b81a71f0c7b8b22ad51c9a0df7a' (2023-06-24)
rycee commented 1 year ago

@hraban Excellent, thanks a lot for trying it out! I'll close this issue with the hope that it is not just working for you. If anybody still have problems, please reopen the issue.

takeda commented 1 year ago

@ncfavier @rycee apologies for the delay. I'm confirming that the issue was resolved for me as well. Thank you!