vpsfreecz / vpsadminos

Host for Linux system containers based on NixOS, ZFS and LXC
https://vpsadminos.org
MIT License
161 stars 27 forks source link

Cannot merge definitions of `system.build.installBootLoader' #56

Closed novmar closed 2 months ago

novmar commented 2 years ago

Hello i am trying to build system, with including file

 <vpsadminos/os/lib/nixos-container/vpsadminos.nix>

and got error:

error: Cannot merge definitions of `system.build.installBootLoader'. Definition values:
       - In `/nix/store/3psgrgjbpd6bkjy143s2niddq35zidfb-git-37d3f75/nixos/modules/virtualisation/container-config.nix': "/nix/store/176gh50y24c0lx2bnnmsvf9wazb73php-coreutils-9.0/bin/true"
       - In `/nix/store/3psgrgjbpd6bkjy143s2niddq35zidfb-git-37d3f75/nixos/modules/system/boot/loader/init-script/init-script.nix': <derivation /nix/store/65w7c71fli7vh0gnqa11272jrc6bqjxj-init-script-builder.sh.drv>

in vpsadminos there are two config parameters, which cause that problem

  boot.loader.initScript.enable = true;
  boot.isContainer = true;

it do this

https://github.com/NixOS/nixpkgs/blob/1477a5e043d36a980ec8c6170293fe563908cef0/nixos/modules/system/boot/loader/init-script/init-script.nix#L45

  config = mkIf config.boot.loader.initScript.enable {

    system.build.installBootLoader = initScriptBuilder;

and this:

https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/container-config.nix#L7

  config = mkIf config.boot.isContainer {
.
.
.
   system.build.installBootLoader = lib.mkDefault "${pkgs.coreutils}/bin/true";
aither64 commented 2 years ago

It depends on what nixpkgs version you use.

On NixOS 21.11, yes, there is an unnoticed conflict, but due to some weird merge behaviour, it actually works. At least for me, even now.

NixOS unstable was shortly broken, because the merge behaviour was changed and the conflict surfaced. However, it was resolved in January. So if you use unstable, just update.

novmar commented 2 years ago

yeah, it was solved after some confctl channel update.

Zurga commented 2 months ago

I am still experiencing this issue with vpsAdminOs installation. I am using the 24.07 image. I updated the vpsadminos channel

aither64 commented 2 months ago

This issue is about NixOS containers running on vpsAdminOS, not vpsAdminOS itself. What command exactly is failing, what is the output and what is the configuration you're trying to build?

Zurga commented 2 months ago

Ah sorry, I misunderstood. If you prefer, I can make a new ticket instead of resurrecting this one.

This is after running os-install --root /mnt.

The conflicting declarations are in:

I did a nix-channel --update to get the installer to work in the first place. Vpsadminos channel is tracking staging.

I am building derivationn vpsadminos-24.05.0pre-git

aither64 commented 2 months ago

Moved to #72