Help! I cant have Pantheon, Gnome and Plasma installed on my system at the same time

Ugh. Looks like it is worse nowadays. Previously, it was just the NIX_GSETTINGS_OVERRIDES_DIR variable, which I have on my to-do list to eventually remove in favour of using the new dconf module. Now it is also defaultSession, which DE modules should not really set and ssh-askpass.

As the error says, you can use lib.mkForce the resolve the conflict. You can choose a value from one of the mentioned modules.

For example, to use GSettings settings (NIX_GSETTINGS_OVERRIDES_DIR) from GNOME, copy the following and wrap the value with lib.mkForce:

In this case, it refers to some variables so you will need to copy them as well:

  environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR =
    let
      cfg = config.services.xserver.desktopManager.gnome;
      nixos-background-light = pkgs.nixos-artwork.wallpapers.simple-blue;
      nixos-background-dark = pkgs.nixos-artwork.wallpapers.simple-dark-gray;
      flashbackEnabled = cfg.flashback.enableMetacity || lib.length cfg.flashback.customSessions > 0;
      nixos-gsettings-desktop-schemas = pkgs.gnome.nixos-gsettings-overrides.override {
        inherit (cfg) extraGSettingsOverrides extraGSettingsOverridePackages favoriteAppsOverride;
        inherit flashbackEnabled nixos-background-dark nixos-background-light;
      };
    in
    lib.mkForce (pkgs.glib.getSchemaPath nixos-gsettings-desktop-schemas);

You will need the same for ssh.askPassword, Have gnome & plasma at the same time? - #2 by BatteredBunny

If you do not use auto-login, you can also set defaultSession to null, which will make DM pre-select the last used session:

services.displayManager.defaultSession = lib.mkForce null;
1 Like