nixpkgs/pkgs/desktops/gnome-3/core/gdm/default.nix

83 lines
2.5 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, substituteAll, pkgconfig, glib, itstool, libxml2, xorg
2018-09-05 01:44:24 +01:00
, accountsservice, libX11, gnome3, systemd, autoreconfHook
2019-02-13 21:47:50 +00:00
, gtk3, libcanberra-gtk3, pam, libtool, gobject-introspection, plymouth
2018-09-05 01:44:24 +01:00
, librsvg, coreutils, xwayland, fetchpatch }:
stdenv.mkDerivation rec {
name = "gdm-${version}";
version = "3.30.3";
src = fetchurl {
url = "mirror://gnome/sources/gdm/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
sha256 = "15f7lz7z75krgbq8vb800afj96h8mw2fpy1s28za2911x5vgq0ak";
};
# Only needed to make it build
preConfigure = ''
substituteInPlace ./configure --replace "/usr/bin/X" "${xorg.xorgserver.out}/bin/X"
'';
2018-04-27 17:53:21 +01:00
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-plymouth=yes"
2018-07-23 00:34:53 +01:00
"--enable-gdm-xsession"
2018-04-27 17:53:21 +01:00
"--with-initial-vt=7"
"--with-systemdsystemunitdir=$(out)/etc/systemd/system"
2018-09-05 01:44:24 +01:00
"--with-udevdir=$(out)/lib/udev"
2018-04-27 17:53:21 +01:00
];
2018-09-05 01:44:24 +01:00
nativeBuildInputs = [ pkgconfig libxml2 itstool autoreconfHook libtool gnome3.dconf ];
2018-04-27 17:53:21 +01:00
buildInputs = [
glib accountsservice systemd
2019-02-13 21:47:50 +00:00
gobject-introspection libX11 gtk3
2018-04-27 17:53:21 +01:00
libcanberra-gtk3 pam plymouth librsvg
];
2016-10-01 23:35:13 +01:00
enableParallelBuilding = true;
2018-04-27 17:53:21 +01:00
patches = [
nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME This adds configuration options which automate the configuration of NVIDIA Optimus using PRIME. This allows using the NVIDIA proprietary driver on Optimus laptops, in order to render using the NVIDIA GPU while outputting to displays connected only to the integrated Intel GPU. It also adds an option for enabling kernel modesetting for the NVIDIA driver (via a kernel command line flag); this is particularly useful together with Optimus/PRIME because it fixes tearing on PRIME-connected screens. The user still needs to enable the Optimus/PRIME feature and specify the bus IDs of the Intel and NVIDIA GPUs, but this is still much easier for users and more reliable. The implementation handles both the X configuration file as well as getting display managers to run certain necessary `xrandr` commands just after X has started. Configuration of commands run after X startup is done using a new configuration option `services.xserver.displayManager.setupCommands`. Support for this option is implemented for LightDM, GDM and SDDM; all of these have been tested with this feature including logging into a Plasma session. Note: support of `setupCommands` for GDM is implemented by making GDM run the session executable via a wrapper; the wrapper will run the `setupCommands` before execing. This seemed like the simplest and most reliable approach, and solves running these commands both for GDM's X server and user X servers (GDM starts separate X servers for itself and user sessions). An alternative approach would be with autostart files but that seems harder to set up and less reliable. Note that some simple features for X configuration file generation (in `xserver.nix`) are added which are used in the implementation: - `services.xserver.extraConfig`: Allows adding arbitrary new sections. This is used to add the Device section for the Intel GPU. - `deviceSection` and `screenSection` within `services.xserver.drivers`. This allows the nvidia configuration module to add additional contents into the `Device` and `Screen` sections of the "nvidia" driver, and not into such sections for other drivers that may be enabled.
2018-06-30 08:33:45 +01:00
# Change hardcoded paths to nix store paths.
2018-04-27 17:53:21 +01:00
(substituteAll {
src = ./fix-paths.patch;
inherit coreutils plymouth xwayland;
2018-04-27 17:53:21 +01:00
})
nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME This adds configuration options which automate the configuration of NVIDIA Optimus using PRIME. This allows using the NVIDIA proprietary driver on Optimus laptops, in order to render using the NVIDIA GPU while outputting to displays connected only to the integrated Intel GPU. It also adds an option for enabling kernel modesetting for the NVIDIA driver (via a kernel command line flag); this is particularly useful together with Optimus/PRIME because it fixes tearing on PRIME-connected screens. The user still needs to enable the Optimus/PRIME feature and specify the bus IDs of the Intel and NVIDIA GPUs, but this is still much easier for users and more reliable. The implementation handles both the X configuration file as well as getting display managers to run certain necessary `xrandr` commands just after X has started. Configuration of commands run after X startup is done using a new configuration option `services.xserver.displayManager.setupCommands`. Support for this option is implemented for LightDM, GDM and SDDM; all of these have been tested with this feature including logging into a Plasma session. Note: support of `setupCommands` for GDM is implemented by making GDM run the session executable via a wrapper; the wrapper will run the `setupCommands` before execing. This seemed like the simplest and most reliable approach, and solves running these commands both for GDM's X server and user X servers (GDM starts separate X servers for itself and user sessions). An alternative approach would be with autostart files but that seems harder to set up and less reliable. Note that some simple features for X configuration file generation (in `xserver.nix`) are added which are used in the implementation: - `services.xserver.extraConfig`: Allows adding arbitrary new sections. This is used to add the Device section for the Intel GPU. - `deviceSection` and `screenSection` within `services.xserver.drivers`. This allows the nvidia configuration module to add additional contents into the `Device` and `Screen` sections of the "nvidia" driver, and not into such sections for other drivers that may be enabled.
2018-06-30 08:33:45 +01:00
# The following patches implement certain environment variables in GDM which are set by
# the gdm configuration module (nixos/modules/services/x11/display-managers/gdm.nix).
2018-04-27 17:53:21 +01:00
./gdm-x-session_extra_args.patch
nixos/xserver: Implement configuration of NVIDIA Optimus via PRIME This adds configuration options which automate the configuration of NVIDIA Optimus using PRIME. This allows using the NVIDIA proprietary driver on Optimus laptops, in order to render using the NVIDIA GPU while outputting to displays connected only to the integrated Intel GPU. It also adds an option for enabling kernel modesetting for the NVIDIA driver (via a kernel command line flag); this is particularly useful together with Optimus/PRIME because it fixes tearing on PRIME-connected screens. The user still needs to enable the Optimus/PRIME feature and specify the bus IDs of the Intel and NVIDIA GPUs, but this is still much easier for users and more reliable. The implementation handles both the X configuration file as well as getting display managers to run certain necessary `xrandr` commands just after X has started. Configuration of commands run after X startup is done using a new configuration option `services.xserver.displayManager.setupCommands`. Support for this option is implemented for LightDM, GDM and SDDM; all of these have been tested with this feature including logging into a Plasma session. Note: support of `setupCommands` for GDM is implemented by making GDM run the session executable via a wrapper; the wrapper will run the `setupCommands` before execing. This seemed like the simplest and most reliable approach, and solves running these commands both for GDM's X server and user X servers (GDM starts separate X servers for itself and user sessions). An alternative approach would be with autostart files but that seems harder to set up and less reliable. Note that some simple features for X configuration file generation (in `xserver.nix`) are added which are used in the implementation: - `services.xserver.extraConfig`: Allows adding arbitrary new sections. This is used to add the Device section for the Intel GPU. - `deviceSection` and `screenSection` within `services.xserver.drivers`. This allows the nvidia configuration module to add additional contents into the `Device` and `Screen` sections of the "nvidia" driver, and not into such sections for other drivers that may be enabled.
2018-06-30 08:33:45 +01:00
# Allow specifying a wrapper for running the session command.
./gdm-x-session_session-wrapper.patch
# Forwards certain environment variables to the gdm-x-session child process
# to ensure that the above two patches actually work.
./gdm-session-worker_forward-vars.patch
# Set up the environment properly when launching sessions
# https://github.com/NixOS/nixpkgs/issues/48255
./reset-environment.patch
2018-04-27 17:53:21 +01:00
];
2017-09-19 11:50:26 +01:00
2018-04-27 17:53:21 +01:00
installFlags = [
"sysconfdir=$(out)/etc"
"dbusconfdir=$(out)/etc/dbus-1/system.d"
];
passthru = {
updateScript = gnome3.updateScript {
packageName = "gdm";
attrPath = "gnome3.gdm";
};
};
meta = with stdenv.lib; {
description = "A program that manages graphical display servers and handles graphical user logins";
2018-04-27 17:53:21 +01:00
homepage = https://wiki.gnome.org/Projects/GDM;
license = licenses.gpl2Plus;
maintainers = gnome3.maintainers;
2018-04-27 17:53:21 +01:00
platforms = platforms.linux;
};
}