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

home-manager as nixos module is broken with documentation.nixos.includeAllModules=true #896

Open
pasqui23 opened this issue Oct 29, 2019 · 6 comments
Labels
bug pinned Prevent marking as stale

Comments

@pasqui23
Copy link
Contributor

pasqui23 commented Oct 29, 2019

I get

sudo nixos-rebuild switch --fast                                   
[sudo] password di paki: 
Riprovare.
[sudo] password di paki: 
building the system configuration...
error: while evaluating the attribute 'activationScript' of the derivation 'nixos-system-nixos-20.03pre198214.4cd2cb43fb3' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:102:5:
while evaluating the attribute 'system.activationScripts.script' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:68:9:
while evaluating 'textClosureMap' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings-with-deps.nix:70:35, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:89:18:
while evaluating 'id' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/trivial.nix:14:5, called from undefined position:
while evaluating the attribute 'text' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/activation-script.nix:9:5:
while evaluating the attribute 'text' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings-with-deps.nix:77:38:
while evaluating the attribute 'sources' of the derivation 'etc' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc.nix:12:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/etc/etc.nix:20:20, called from undefined position:
while evaluating the attribute 'source' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:336:9:
while evaluating the option `environment.etc.systemd/system.source':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:32, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:19:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:246:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:369:10:
while evaluating the attribute 'buildCommand' of the derivation 'system-units' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'text' of the derivation 'unit-dbus.service' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'text' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:336:9:
while evaluating the option `systemd.units.dbus.service.text':
while evaluating the attribute 'isDefined' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:373:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:456:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:415:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:234:44:
while evaluating 'commonUnitText' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd.nix:310:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd.nix:326:14:
while evaluating 'attrsToSection' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd-lib.nix:104:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd.nix:312:9:
while evaluating 'mapAttrsToList' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:233:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd-lib.nix:105:33:
while evaluating the attribute 'unitConfig' at undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:75:45, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:336:9:
while evaluating the option `systemd.services.dbus.unitConfig':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:32, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:19:
while evaluating 'merge' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:283:20, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:371:8:
while evaluating 'filterAttrs' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:124:23, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:284:35:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:125:29, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:125:18:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:284:51, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:125:62:
while evaluating the attribute 'X-Restart-Triggers' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:344:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:284:86, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:344:15:
while evaluating the attribute 'optionalValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:375:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:362:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:456:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:28, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:348:17:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:415:25, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:349:62:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:288:60:
while evaluating the attribute 'serviceDirectories' of the derivation 'dbus-1' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:258:14, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:376:27:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:32, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:368:19:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:246:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:369:10:
while evaluating the attribute 'passAsFile' of the derivation 'system-path' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'buildCommand' of the derivation 'nixos-manpages' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'buildCommand' of the derivation 'manual-olinkdb' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'buildCommand' of the derivation 'nixos-manual-combined' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'buildCommand' of the derivation 'generated-docbook' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'buildCommand' of the derivation 'options-docbook.xml' at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/pkgs/build-support/trivial-builders.nix:7:14:
in 'toFile': the file 'options.xml' cannot refer to derivation outputs, at /nix/store/aglz0xgg6ii2qmw08s0rs329rrh1vb2k-nixos-20.03pre198214.4cd2cb43fb3/nixos/nixos/lib/make-options-doc/default.nix:89:16

With the following in configuration.nix:

{config,pkgs,...}:
let
  hm=builtins.fetchTarball https://github.com/rycee/home-manager/archive/master.tar.gz ;
in{
  imports=[
    
    "${hm}/nixos"
  ];
  documentation.nixos.includeAllModules=true;
  home-manager={
    useUserPackages=true;
    backupFileExtension="hm~";
    verbose=true;
    users.paki={
      nixpkgs.config.allowUnfree=true;
      programs={
        vscode={
          enable=true;
          extensions=with pkgs.vscode-extensions;[
            ms-vscode.cpptools llvm-org.lldb-vscode #alanz.vscode-hie-server
            # ms-python.python
            ];
          userSettings={
              #...
          };
        };
      };
    };
  };
}

Commenting the documentation line allow the nixos-rebuild

@MichaelBergquistSuarez
Copy link

MichaelBergquistSuarez commented Dec 13, 2019

I have good news! And I have bad news... I think.

The good news is that I think this was fixed in NixOS/nixpkgs#73966

A workaround until the fix is added to your channel may be to use the ustable nixosOptionsDoc package with an overlay.

So, if you're using home-manager as a NixOS module you could do something like this
{ config, ... }:

let
  # Make pkgs.unstable available for future usage
  addUnstableScope = self: super: {
    unstable = import <nixos-unstable> {
      config = config.nixpkgs.config;
    };
  };
  # Use pkgs.unstable.nixosOptionsDoc instead of pkgs.nixosOptionsDoc
  upgradePackages = self: super: {
    nixosOptionsDoc = self.unstable.nixosOptionsDoc;
  };
in {
  nixpkgs.overlays = [ addUnstableScope upgradePackages ];
}

And now the bad news; When you get past that point there's another problem (which is also mentioned in NixOS/nixpkgs#73966):

manual-combined.xml:19435: element link: validity error : IDREF attribute linkend references an unknown ID "opt-xsession.windowManager.i3.config.assigns"
 19431  See <option>--no-startup-id</option> option description in the i3 user guide.
 19432  </para><para><emphasis>Type:</emphasis> boolean</para><para><emphasis>Default:</emphasis> <literal>
 19433          true
 19434        </literal></para><para><emphasis>Declared by:</emphasis></para><simplelist><member><filename xlink:href="file:///nix/store/5waim0srcbmknj2d1grskdzphdi61aa8-home-manager/modules/services/window-managers/i3.nix">/nix/store/5waim0srcbmknj2d1grskdzphdi61aa8-home-manager/modules/services/window-managers/i3.nix</filename></member></simplelist></listitem></varlistentry><varlistentry><term xlink:href="#opt-home-manager.users._name_.xsession.windowManager.i3.config.startup._.workspace" xml:id="opt-home-manager.users._name_.xsession.windowManager.i3.config.startup._.workspace"><option>home-manager.users.&lt;name&gt;.xsession.windowManager.i3.config.startup.*.workspace</option></term><listitem><para>Launch application on a particular workspace. DEPRECATED:
 19435  Use <varname><link linkend="opt-xsession.windowManager.i3.config.assigns">xsession.windowManager.i3.config.assigns</link></varname>
 19436  instead. See <link xlink:href="https://github.com/rycee/home-manager/issues/265"/>.
 19437  </para><para><emphasis>Type:</emphasis> null or string</para><para><emphasis>Default:</emphasis> <literal>

I'm trying to investigate it, but any help is appreciated since the documentation is a new area to me.

It looks like the "unknown ID" option is defined here: https://github.com/rycee/home-manager/blob/release-19.09/modules/services/window-managers/i3.nix#L387 so I'm not yet sure what the issue really is.

Maybe it is looking in the wrong place (the ID is defined wrong)? I dunno. But I'm thinking xsession.windowManager.i3.config.assigns is a home-manager option (not a nixos option) so I assume it should be scoped(?)

@bqv
Copy link
Contributor

bqv commented Mar 30, 2020

This is still an issue...

@bqv
Copy link
Contributor

bqv commented Mar 30, 2020

Ah, your link references the release pinned at 19.09. Current unstable does have an assigns option, but it's hidden in a nullable submodule type: https://github.com/rycee/home-manager/blob/5969551a5cc52f9470b5ff5ca01327bf4bda82c1/modules/services/window-managers/i3-sway/i3.nix#L254 - I think that may be the underlying issue, because once I made that type non-nullable, I saw a similar issue due to a nullable string in programs.go.goPath

@bqv
Copy link
Contributor

bqv commented Mar 30, 2020

I give up trying to fix this. I got as far as this patch to fix al the bad validations, and then the manual derivations fail to build at all due to illegal path references.

@teto teto added the bug label Dec 4, 2020
@Ma27
Copy link
Member

Ma27 commented Mar 11, 2021

FWIW I'm currently using this as a workaround: Ma27@01db651

A few thoughts in case people are interested in getting this fixed here:

  • The linkend=-attrs for docbook could be manually adjusted with some _module.args magic (e.g. _module.args.prefix = "home-manager.users._name_." and then prefix could be added everywhere).
  • I found a few wrong references to derivations (i.e. in example = literalExample ... ${pkgs.foobar} should be escaped with a $$ in multiline strings or \$ everywhere else). These changes could be applied here directly.
  • For some reason I don't understand, the string context issues don't go away if you set defaultText = for the affected options. Actually, default = gets replaced with defaultText in lib.optionAttrSetToDocList, but the references are still here. I guess this could be worked around with some builtins.unsafeDiscardStringContext-magic. My own workaround was to just alter the defaults. Those will cause issues when actually using the modules, but it was good enough for me since I don't use the modules I had to patch.

@stale
Copy link

stale bot commented Jun 10, 2021

Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

If you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information.

Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

@stale stale bot added the status: stale label Jun 10, 2021
@berbiche berbiche added the pinned Prevent marking as stale label Jun 10, 2021
@stale stale bot removed the status: stale label Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pinned Prevent marking as stale
Projects
None yet
Development

No branches or pull requests

6 participants