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

error: The unique option `system.build.installBootLoader' is defined multiple times. #156373

Closed
SFrijters opened this issue Jan 23, 2022 · 5 comments
Labels
0.kind: bug Something is broken 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS

Comments

@SFrijters
Copy link
Member

Describe the bug

After updating my system flake I get this error on rebuild:

building the system configuration...
error: The unique option `system.build.installBootLoader' is defined multiple times. Definition values:
       - In `/nix/store/if27n2zk0w5s62jk2bq32qm33r4xzyd0-source/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix': <derivation /nix/store/137hq8hkiicgi8zkmbpvnmqwbgr0ds9c-systemd-boot.drv>
       - In `/nix/store/if27n2zk0w5s62jk2bq32qm33r4xzyd0-source/nixos/modules/system/boot/loader/grub/grub.nix': <derivation /nix/store/4nmjqwyazvpaq9qbly4gd25gbijxb0pz-install-grub.sh.drv>

The relevant section of my configuration.nix is (I think):

  # Use the systemd-boot EFI boot loader.
  boot = {
    loader = {
      timeout = 10;
      systemd-boot.enable = true;
      efi.canTouchEfiVariables = true;
      grub = {
        enable = true;
        device = "nodev";
        efiSupport = true;
        useOSProber = true;
      };
    };
   ...

I assume this has something to do with #155963 - what would be the proper way to resolve this? I think one of them would have won out over the other before, is there any way to know which one so I can keep the status quo?

Steps To Reproduce

Have the above snippet of configuration in configuration.nix, build the system with nixpkgs 80458a3.

Expected behavior

The system builds succesfully.

Notify maintainers

@roberth @ncfavier

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 5.16.0, NixOS, 22.05 (Quokka)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.6.0pre20211217_6e6e998`
 - channels(frijters): `""`
 - channels(root): `"nixos, nixos-unstable-20.09pre225264.683c68232e9"`
 - nixpkgs: `/etc/nixpkgs`
@SFrijters SFrijters added the 0.kind: bug Something is broken label Jan 23, 2022
@roberth
Copy link
Member

roberth commented Jan 23, 2022

Do you use both bootloaders?

@veprbl veprbl added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Jan 23, 2022
@ncfavier
Copy link
Member

In this case grub was winning. Generally the "last" definition wins because of the way types.attrs.merge is implemented, and you can see the order from your error message.

@SFrijters
Copy link
Member Author

I went back through the git history of my config and the boot block was effectively there from the very beginning, so I probably copied it from somewhere without full understanding. Since grub was apparently winning anyway I've removed the systemd-boot.enable = true; line and all seems to be well now. Thanks for the fast responses.

Regarding the error message: I don't think it's clear (without digging into the source) that the last entry was winning before. But that seems a moot point now anyway.

@ncfavier
Copy link
Member

I never said it was clear!

@roberth
Copy link
Member

roberth commented Jan 24, 2022

#156503 should improve the error message.

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 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

No branches or pull requests

4 participants