NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.01k stars 13.36k forks source link

`services.xserver.displayManager.job.execCmd' is defined multiple times #47945

Closed hcmeyer closed 5 years ago

hcmeyer commented 5 years ago

Issue description

The unique option services.xserver.displayManager.job.execCmd' is defined multiple times in/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/services/x11/display-managers/sddm.nix' and `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/services/x11/display-managers/gdm.nix'.

Steps to reproduce

nixos-rebuild switch --upgrade

Technical details

first try with nixos-18.09

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

hedning commented 5 years ago

It looks like the system is trying to enable botth gdm and sddm which doesn't work. Probably related to https://github.com/NixOS/nixpkgs/pull/30890. What's your services.xserver config? Specifically desktopManager and displayManager.

hcmeyer commented 5 years ago

I am not sure where or what to look for, but

/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/services/x11/display-managers/default.nix says:

options = {

services.xserver.displayManager = {

  xauthBin = mkOption {
    internal = true;
    default = "${xorg.xauth}/bin/xauth";
    description = "Path to the <command>xauth</command> program used by display managers.";
  };

  xserverBin = mkOption {
    type = types.path;
    description = "Path to the X server used by display managers.";
  };

  xserverArgs = mkOption {
    type = types.listOf types.str;
    default = [];
    example = [ "-ac" "-logverbose" "-verbose" "-nolisten tcp" ];
    description = "List of arguments for the X server.";
  };

  sessionCommands = mkOption {
    type = types.lines;
    default = "";
    example =
      ''
        xmessage "Hello World!" &
      '';
    description = "Shell commands executed just before the window or desktop manager is started.";
  };

  hiddenUsers = mkOption {
    type = types.listOf types.str;
    default = [ "nobody" ];
    description = ''
      A list of users which will not be shown in the display manager.
    '';
  };

and

/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix says:

services.xserver.desktopManager = {

  wallpaper = {
    mode = mkOption {
      type = types.enum [ "center" "fill" "max" "scale" "tile" ];
      default = "scale";
      example = "fill";
      description = ''
        The file <filename>~/.background-image</filename> is used as a background image.
        This option specifies the placement of this image onto your desktop.

        Possible values:
        <literal>center</literal>: Center the image on the background. If it is too small, it will be surrounded by a black border.
        <literal>fill</literal>: Like <literal>scale</literal>, but preserves aspect ratio by zooming the image until it fits. Either a horizontal or a vertical part of the image will be cut off.
        <literal>max</literal>: Like <literal>fill</literal>, but scale the image to the maximum size that fits the screen with black borders on one side.
        <literal>scale</literal>: Fit the file into the background without repeating it, cutting off stuff or using borders. But the aspect ratio is not preserved either.
        <literal>tile</literal>: Tile (repeat) the image in case it is too small for the screen.
      '';
    };

    combineScreens = mkOption {
      type = types.bool;
      default = false;
      description = ''
        When set to <literal>true</literal> the wallpaper will stretch across all screens.
        When set to <literal>false</literal> the wallpaper is duplicated to all screens.
      '';
    };
  };

  session = mkOption {
    internal = true;
    default = [];
    example = singleton
      { name = "kde";
        bgSupport = true;
        start = "...";
      };
    description = ''
      Internal option used to add some common line to desktop manager
      scripts before forwarding the value to the
      <varname>displayManager</varname>.
    '';
    apply = list: {
      list = map (d: d // {
        manage = "desktop";
        start = d.start
        + optionalString (needBGCond d) ''
          if [ -e $HOME/.background-image ]; then
            ${pkgs.feh}/bin/feh --bg-${cfg.wallpaper.mode} ${optionalString cfg.wallpaper.combineScreens "--no-xinerama"} $HOME/.background-image
          else
            # Use a solid black background as fallback
            ${pkgs.xorg.xsetroot}/bin/xsetroot -solid black
          fi
        '';
      }) list;
      needBGPackages = [] != filter needBGCond list;
    };
  };

  default = mkOption {
    type = types.str;
    default = "";
    example = "none";
    description = "Default desktop manager loaded if none have been chosen.";
    apply = defaultDM:
      if defaultDM == "" && cfg.session.list != [] then
        (head cfg.session.list).name
      else if any (w: w.name == defaultDM) cfg.session.list then
        defaultDM
      else
        builtins.trace ''
          Default desktop manager (${defaultDM}) not found at evaluation time.
          These are the known valid session names:
            ${concatMapStringsSep "\n  " (w: "services.xserver.desktopManager.default = \"${w.name}\";") cfg.session.list}
          It's also possible the default can be found in one of these packages:
            ${concatMapStringsSep "\n  " (p: p.name) config.services.xserver.displayManager.extraSessionFilePackages}
        '' defaultDM;
  };

};

};

These are where grep finds desktopManager and displayManager on the left side of an equals sign.

hedning commented 5 years ago

Ah, sorry should've specified that I was referring to your system configuration file: /etc/nixos/configuration.nix.

If both gdm and sddm is enabled in your config, simply remove the one you don't want (gdm is typically used by gnome and sddm by plasma/kde). If that's not the case we're dealing with a bug (probably triggered by enabling the plasma5 and gnome3 desktop managers).

Stuff to try out if the above doesn't work or apply would be to explicitly set the display manager to your preference (eg. gdm if you're using gnome and sddm if you're using plasma). If that doesn't work try to also disable the display manager you're not using, eg. services.xserver.displayManager.sddm.enable = false. That should hopefully fix it until we can fix the problem properly.

hcmeyer commented 5 years ago

Thank you, Tor.

/etc/nixos/configuration.nix said:

Enable the xfce Desktop Environment.

services.xserver.displayManager.sddm.enable = true; services.xserver.desktopManager.xfce.enable = true; services.xserver.desktopManager.gnome3.enable = true; # I changed it to:

Enable the xfce Desktop Environment.

services.xserver.displayManager.sddm.enable = true;

services.xserver.desktopManager.xfce.enable = true; services.xserver.desktopManager.gnome3.enable = true; # to turn off sddm, and the system built and worked.

I use the xfce desktop, the gnome3 desktop does not work on this particular laptop. I have to enable gnome3 for network manager and bluetooth. I have never tried kde on this system, I don't like it much, and it did not appear as an option on the login screen.

I am curious why sddm is a display manager, and gnome3 and xfce are desktop managers, in this section.

Carl

On Sat, Oct 6, 2018 at 8:10 PM Tor Hedin Brønner notifications@github.com wrote:

Ah, sorry should've specified that I was referring to your system configuration file: /etc/nixos/configuration.nix.

If both gdm and sddm is enabled in your config, simply remove the one you don't want (gdm is typically used by gnome and sddm by plasma/kde). If that's not the case we're dealing with a bug (probably triggered by enabling the plasma5 and gnome3 desktop managers).

Stuff to try out if the above doesn't work or apply would be to explicitly set the display manager to your preference (eg. gdm if you're using gnome and sddm if you're using plasma). If that doesn't work try to also disable the display manager you're not using, eg. services.xserver.displayManager.sddm.enable = false. That should hopefully fix it until we can fix the problem properly.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NixOS/nixpkgs/issues/47945#issuecomment-427615251, or mute the thread https://github.com/notifications/unsubscribe-auth/ACi3ePhzD3K2lv_Wtig3MUSBcl3-HO8nks5uiUZfgaJpZM4XLDMv .

hedning commented 5 years ago

Glad it worked. You should be able to replace ...gnome3.enable = true with networking.networkmanager.enable = true, that way you'll avoid pulling in a bunch of stuff you don't necessarily want. I'm guessing this happened when trying to upgrade to 18.09? Else I can't quite understand how gnome3 would pull in gdm.

A display manager is simply used to log into a desktop manager/environment like xfce.

hcmeyer commented 5 years ago

No, I had added gnome3 with 17.09, where I started. I hacked about to get Nix installed from flash and ethernet, and added gnome to get network manager for wireless. And bluetooth for a trackball I use.

With 18.09. gnome desktop now works, with and without Xorg. I don't know which desktop I will use.

The purpose of this system was to have something besides fedora, and to experiment with Haskell. The computer is an Acer Asipre, with a touch screen and Amd hardware. I picked it up cheap as refurbished. It is rather idiosyncratic.

Carl

On Sun, Oct 7, 2018 at 12:06 PM Tor Hedin Brønner notifications@github.com wrote:

Glad it worked. You should be able to replace ...gnome3.enable = true with networking.networkmanager.enable = true https://nixos.org/nixos/options.html#networkmanager.enable, that way you'll avoid pulling in a bunch of stuff you don't necessarily want. I'm guessing this happened when trying to upgrade to 18.09? Else I can't quite understand how gnome3 would pull in gdm.

A display manager is simply used to log into a desktop manager/environment like xfce.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NixOS/nixpkgs/issues/47945#issuecomment-427664724, or mute the thread https://github.com/notifications/unsubscribe-auth/ACi3ePKi5t_yk3LcXzqod3xs2NV8xLbuks5uiiZ4gaJpZM4XLDMv .

hedning commented 5 years ago

The root cause should've been addressed in https://github.com/NixOS/nixpkgs/pull/48080.