diff options
Diffstat (limited to 'nixos/modules/services/x11')
33 files changed, 736 insertions, 706 deletions
diff --git a/nixos/modules/services/x11/compton.nix b/nixos/modules/services/x11/compton.nix index 7cbca1dcddfd..d75d24830f8d 100644 --- a/nixos/modules/services/x11/compton.nix +++ b/nixos/modules/services/x11/compton.nix @@ -43,7 +43,6 @@ in { enable = mkOption { type = types.bool; default = false; - example = true; description = '' Whether of not to enable Compton as the X.org composite manager. ''; @@ -52,7 +51,6 @@ in { fade = mkOption { type = types.bool; default = false; - example = true; description = '' Fade windows in and out. ''; @@ -85,7 +83,7 @@ in { "focused = 1" ]; description = '' - List of condition of windows that should have no shadow. + List of conditions of windows that should not be faded. See <literal>compton(1)</literal> man page for more examples. ''; }; @@ -93,7 +91,6 @@ in { shadow = mkOption { type = types.bool; default = false; - example = true; description = '' Draw window shadows. ''; @@ -126,7 +123,7 @@ in { "focused = 1" ]; description = '' - List of condition of windows that should have no shadow. + List of conditions of windows that should have no shadow. See <literal>compton(1)</literal> man page for more examples. ''; }; diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index 144e4aada277..d56050c36269 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -8,7 +8,7 @@ let cfg = xcfg.desktopManager; # If desktop manager `d' isn't capable of setting a background and - # the xserver is enabled, the `feh' program is used as a fallback. + # the xserver is enabled, `feh' or `xsetroot' are used as a fallback. needBGCond = d: ! (d ? bgSupport && d.bgSupport) && xcfg.enable; in @@ -16,11 +16,10 @@ in { # Note: the order in which desktop manager modules are imported here # determines the default: later modules (if enabled) are preferred. - # E.g., if KDE is enabled, it supersedes xterm. + # E.g., if Plasma 5 is enabled, it supersedes xterm. imports = [ - ./none.nix ./xterm.nix ./xfce.nix ./kde4.nix ./kde5.nix - ./lumina.nix ./lxqt.nix ./enlightenment.nix ./gnome3.nix - ./kodi.nix + ./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix + ./lxqt.nix ./enlightenment.nix ./gnome3.nix ./kodi.nix ]; options = { @@ -45,8 +44,11 @@ in manage = "desktop"; start = d.start + optionalString (needBGCond d) '' - if test -e $HOME/.background-image; then + if [ -e $HOME/.background-image ]; then ${pkgs.feh}/bin/feh --bg-scale $HOME/.background-image + else + # Use a solid black background as fallback + ${pkgs.xorg.xsetroot}/bin/xsetroot -solid black fi ''; }) list; @@ -81,6 +83,6 @@ in config = { services.xserver.displayManager.session = cfg.session.list; environment.systemPackages = - mkIf cfg.session.needBGPackages [ pkgs.feh ]; + mkIf cfg.session.needBGPackages [ pkgs.feh ]; # xsetroot via xserver.enable }; } diff --git a/nixos/modules/services/x11/desktop-managers/enlightenment.nix b/nixos/modules/services/x11/desktop-managers/enlightenment.nix index 7ea8b30d23d1..b02eaf861a0d 100644 --- a/nixos/modules/services/x11/desktop-managers/enlightenment.nix +++ b/nixos/modules/services/x11/desktop-managers/enlightenment.nix @@ -20,7 +20,6 @@ in services.xserver.desktopManager.enlightenment.enable = mkOption { default = false; - example = true; description = "Enable the Enlightenment desktop environment."; }; @@ -62,10 +61,10 @@ in ''; }]; - security.setuidPrograms = [ "e_freqset" ]; + security.wrappers.e_freqset.source = "${e.enlightenment.out}/bin/e_freqset"; environment.etc = singleton - { source = "${pkgs.xkeyboard_config}/etc/X11/xkb"; + { source = xcfg.xkbDir; target = "X11/xkb"; }; diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 17e84b1d9a16..a1790ccd675c 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -53,7 +53,6 @@ in { services.xserver.desktopManager.gnome3 = { enable = mkOption { default = false; - example = true; description = "Enable Gnome 3 desktop manager."; }; @@ -78,7 +77,7 @@ in { }; debug = mkEnableOption "gnome-session debug messages"; - }; + }; environment.gnome3.packageSet = mkOption { default = null; @@ -86,7 +85,7 @@ in { description = "Which GNOME 3 package set to use."; apply = p: if p == null then pkgs.gnome3 else p; }; - + environment.gnome3.excludePackages = mkOption { default = []; example = literalExample "[ pkgs.gnome3.totem ]"; @@ -125,6 +124,9 @@ in { services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center services.udev.packages = [ pkgs.gnome3.gnome_settings_daemon ]; + # If gnome3 is installed, build vim for gtk3 too. + nixpkgs.config.vim.gui = "gtk3"; + fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell_fonts ]; services.xserver.desktopManager.session = singleton diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix deleted file mode 100644 index 3aa4821a0521..000000000000 --- a/nixos/modules/services/x11/desktop-managers/kde4.nix +++ /dev/null @@ -1,199 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - xcfg = config.services.xserver; - cfg = xcfg.desktopManager.kde4; - xorg = pkgs.xorg; - kde_workspace = config.services.xserver.desktopManager.kde4.kdeWorkspacePackage; - - # Disable Nepomuk and Strigi by default. As of KDE 4.7, they don't - # really work very well (e.g. searching files often fails to find - # files), segfault sometimes and consume significant resources. - # They can be re-enabled in the KDE System Settings under "Desktop - # Search". - disableNepomuk = pkgs.writeTextFile - { name = "nepomuk-config"; - destination = "/share/config/nepomukserverrc"; - text = - '' - [Basic Settings] - Start Nepomuk=false - - [Service-nepomukstrigiservice] - autostart=false - ''; - }; - - phononBackends = { - gstreamer = [ - pkgs.phonon-backend-gstreamer - pkgs.gst_all.gstPluginsBase - pkgs.gst_all.gstPluginsGood - pkgs.gst_all.gstPluginsUgly - pkgs.gst_all.gstPluginsBad - pkgs.gst_all.gstFfmpeg # for mp3 playback - pkgs.gst_all.gstreamer # needed? - ]; - - vlc = [pkgs.phonon-backend-vlc]; - }; - - phononBackendPackages = flip concatMap cfg.phononBackends - (name: attrByPath [name] (throw "unknown phonon backend `${name}'") phononBackends); - -in - -{ - options = { - - services.xserver.desktopManager.kde4 = { - enable = mkOption { - type = types.bool; - default = false; - description = "Enable the KDE 4 desktop environment."; - }; - - phononBackends = mkOption { - type = types.listOf types.str; - default = ["gstreamer"]; - example = ["gstreamer" "vlc"]; - description = "Which phonon multimedia backend kde should use"; - }; - - kdeWorkspacePackage = mkOption { - internal = true; - default = pkgs.kde4.kde_workspace; - defaultText = "pkgs.kde4.kde_workspace"; - type = types.package; - description = "Custom kde-workspace, used for NixOS rebranding."; - }; - - enablePIM = mkOption { - type = types.bool; - default = true; - description = "Whether to enable PIM support. Note that enabling this pulls in Akonadi and MariaDB as dependencies."; - }; - - enableNepomuk = mkOption { - type = types.bool; - default = false; - description = "Whether to enable Nepomuk (deprecated)."; - }; - }; - }; - - - config = mkIf (xcfg.enable && cfg.enable) { - - # If KDE 4 is enabled, make it the default desktop manager (unless - # overridden by the user's configuration). - # !!! doesn't work yet ("Multiple definitions. Only one is allowed - # for this option.") - # services.xserver.desktopManager.default = mkOverride 900 "kde4"; - - services.xserver.desktopManager.session = singleton - { name = "kde4"; - bgSupport = true; - start = - '' - # The KDE icon cache is supposed to update itself - # automatically, but it uses the timestamp on the icon - # theme directory as a trigger. Since in Nix the - # timestamp is always the same, this doesn't work. So as - # a workaround, nuke the icon cache on login. This isn't - # perfect, since it may require logging out after - # installing new applications to update the cache. - # See http://lists-archives.org/kde-devel/26175-what-when-will-icon-cache-refresh.html - rm -fv $HOME/.kde/cache-*/icon-cache.kcache - - # Qt writes a weird ‘libraryPath’ line to - # ~/.config/Trolltech.conf that causes the KDE plugin - # paths of previous KDE invocations to be searched. - # Obviously using mismatching KDE libraries is potentially - # disastrous, so here we nuke references to the Nix store - # in Trolltech.conf. A better solution would be to stop - # Qt from doing this wackiness in the first place. - if [ -e $HOME/.config/Trolltech.conf ]; then - sed -e '/nix\\store\|nix\/store/ d' -i $HOME/.config/Trolltech.conf - fi - - # Load PulseAudio module for routing support. - # See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/ - ${optionalString config.hardware.pulseaudio.enable '' - ${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1" - ''} - - # Start KDE. - exec ${kde_workspace}/bin/startkde - ''; - }; - - security.setuidOwners = singleton - { program = "kcheckpass"; - source = "${kde_workspace}/lib/kde4/libexec/kcheckpass"; - owner = "root"; - group = "root"; - setuid = true; - }; - - environment.systemPackages = - [ pkgs.kde4.kdelibs - - pkgs.kde4.kde_baseapps # Splitted kdebase - kde_workspace - pkgs.kde4.kde_runtime - pkgs.kde4.konsole - pkgs.kde4.kate - - pkgs.kde4.kde_wallpapers # contains kdm's default background - pkgs.kde4.oxygen_icons - - # Starts KDE's Polkit authentication agent. - pkgs.kde4.polkit_kde_agent - - # Miscellaneous runtime dependencies. - pkgs.kde4.qt4 # needed for qdbus - pkgs.shared_mime_info - xorg.xmessage # so that startkde can show error messages - xorg.xset # used by startkde, non-essential - xorg.xauth # used by kdesu - ] - ++ optionals cfg.enablePIM - [ pkgs.kde4.kdepim_runtime - pkgs.kde4.akonadi - pkgs.mysql # used by akonadi - ] - ++ (if cfg.enableNepomuk then - [ pkgs.shared_desktop_ontologies # used by nepomuk - pkgs.strigi # used by nepomuk - pkgs.virtuoso # to enable Nepomuk to find Virtuoso - ] else - [ disableNepomuk ]) - ++ optional config.hardware.pulseaudio.enable pkgs.kde4.kmix # Perhaps this should always be enabled - ++ optional config.hardware.bluetooth.enable pkgs.kde4.bluedevil - ++ optional config.networking.networkmanager.enable pkgs.kde4.plasma-nm - ++ phononBackendPackages; - - environment.pathsToLink = [ "/share" ]; - - environment.profileRelativeEnvVars = mkIf (elem "gstreamer" cfg.phononBackends) { - GST_PLUGIN_SYSTEM_PATH = [ "/lib/gstreamer-0.10" ]; - }; - - environment.etc = singleton - { source = "${pkgs.xkeyboard_config}/etc/X11/xkb"; - target = "X11/xkb"; - }; - - # Enable helpful DBus services. - services.udisks2.enable = true; - services.upower.enable = config.powerManagement.enable; - - security.pam.services.kde = { allowNullPassword = true; }; - - }; - -} diff --git a/nixos/modules/services/x11/desktop-managers/kde5.nix b/nixos/modules/services/x11/desktop-managers/kde5.nix deleted file mode 100644 index de5bfe263d49..000000000000 --- a/nixos/modules/services/x11/desktop-managers/kde5.nix +++ /dev/null @@ -1,253 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - xcfg = config.services.xserver; - cfg = xcfg.desktopManager.kde5; - xorg = pkgs.xorg; - - kde5 = pkgs.kde5; - -in - -{ - options = { - - services.xserver.desktopManager.kde5 = { - enable = mkOption { - type = types.bool; - default = false; - description = "Enable the Plasma 5 (KDE 5) desktop environment."; - }; - - enableQt4Support = mkOption { - type = types.bool; - default = true; - description = '' - Enable support for Qt 4-based applications. Particularly, install the - Qt 4 version of the Breeze theme and a default backend for Phonon. - ''; - }; - - extraPackages = mkOption { - type = types.listOf types.package; - default = []; - description = '' - KDE packages that need to be installed system-wide. - ''; - }; - - }; - - }; - - - config = mkMerge [ - (mkIf (cfg.extraPackages != []) { - environment.systemPackages = [ (kde5.kdeWrapper cfg.extraPackages) ]; - }) - - (mkIf (xcfg.enable && cfg.enable) { - - warnings = optional config.services.xserver.desktopManager.kde4.enable - "KDE 4 should not be enabled at the same time as KDE 5"; - - services.xserver.desktopManager.session = singleton { - name = "kde5"; - bgSupport = true; - start = '' - # Load PulseAudio module for routing support. - # See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/ - ${optionalString config.hardware.pulseaudio.enable '' - ${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1" - ''} - - exec "${kde5.startkde}" - - ''; - }; - - security.setuidOwners = [ - { - program = "kcheckpass"; - source = "${kde5.plasma-workspace.out}/lib/libexec/kcheckpass"; - owner = "root"; - setuid = true; - } - { - program = "start_kdeinit"; - source = "${kde5.kinit.out}/lib/libexec/kf5/start_kdeinit"; - owner = "root"; - setuid = true; - } - ]; - - environment.systemPackages = - [ - kde5.frameworkintegration - kde5.kactivities - kde5.kauth - kde5.kcmutils - kde5.kconfig - kde5.kconfigwidgets - kde5.kcoreaddons - kde5.kdbusaddons - kde5.kdeclarative - kde5.kded - kde5.kdesu - kde5.kdnssd - kde5.kemoticons - kde5.kfilemetadata - kde5.kglobalaccel - kde5.kguiaddons - kde5.kiconthemes - kde5.kidletime - kde5.kimageformats - kde5.kinit - kde5.kio - kde5.kjobwidgets - kde5.knewstuff - kde5.knotifications - kde5.knotifyconfig - kde5.kpackage - kde5.kparts - kde5.kpeople - kde5.krunner - kde5.kservice - kde5.ktextwidgets - kde5.kwallet - kde5.kwayland - kde5.kwidgetsaddons - kde5.kxmlgui - kde5.kxmlrpcclient - kde5.plasma-framework - kde5.solid - kde5.sonnet - kde5.threadweaver - - kde5.breeze-qt5 - kde5.kactivitymanagerd - kde5.kde-cli-tools - kde5.kdecoration - kde5.kdeplasma-addons - kde5.kgamma5 - kde5.khotkeys - kde5.kinfocenter - kde5.kmenuedit - kde5.kscreen - kde5.kscreenlocker - kde5.ksysguard - kde5.kwayland - kde5.kwin - kde5.kwrited - kde5.libkscreen - kde5.libksysguard - kde5.milou - kde5.plasma-integration - kde5.polkit-kde-agent - kde5.systemsettings - - kde5.plasma-desktop - kde5.plasma-workspace - kde5.plasma-workspace-wallpapers - - kde5.dolphin-plugins - kde5.ffmpegthumbs - kde5.kdegraphics-thumbnailers - kde5.kio-extras - kde5.print-manager - - # Install Breeze icons if available - (kde5.breeze-icons or kde5.oxygen-icons5 or kde5.oxygen-icons) - pkgs.hicolor_icon_theme - - kde5.kde-gtk-config kde5.breeze-gtk - - pkgs.qt5.phonon-backend-gstreamer - ] - - # Plasma 5.5 and later has a Breeze GTK theme. - # If it is not available, Orion is very similar to Breeze. - ++ lib.optional (!(lib.hasAttr "breeze-gtk" kde5)) pkgs.orion - - # Install activity manager if available - ++ lib.optional (lib.hasAttr "kactivitymanagerd" kde5) kde5.kactivitymanagerd - - # frameworkintegration was split with plasma-integration in Plasma 5.6 - ++ lib.optional (lib.hasAttr "plasma-integration" kde5) kde5.plasma-integration - - ++ lib.optionals cfg.enableQt4Support [ kde5.breeze-qt4 pkgs.phonon-backend-gstreamer ] - - # Optional hardware support features - ++ lib.optional config.hardware.bluetooth.enable kde5.bluedevil - ++ lib.optional config.networking.networkmanager.enable kde5.plasma-nm - ++ lib.optional config.hardware.pulseaudio.enable kde5.plasma-pa - ++ lib.optional config.powerManagement.enable kde5.powerdevil - ++ lib.optional config.services.colord.enable pkgs.colord-kde - ++ lib.optionals config.services.samba.enable [ kde5.kdenetwork-filesharing pkgs.samba ]; - - services.xserver.desktopManager.kde5.extraPackages = - [ - kde5.khelpcenter - kde5.oxygen - - kde5.dolphin - kde5.konsole - ]; - - environment.pathsToLink = [ "/share" ]; - - environment.etc = singleton { - source = "${pkgs.xkeyboard_config}/etc/X11/xkb"; - target = "X11/xkb"; - }; - - environment.variables = - { - # Enable GTK applications to load SVG icons - GST_PLUGIN_SYSTEM_PATH_1_0 = - lib.makeSearchPath "/lib/gstreamer-1.0" - (builtins.map (pkg: pkg.out) (with pkgs.gst_all_1; [ - gstreamer - gst-plugins-base - gst-plugins-good - gst-plugins-ugly - gst-plugins-bad - gst-libav # for mp3 playback - ])); - } - // (if (lib.hasAttr "breeze-icons" kde5) - then { GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; } - else { }); - - fonts.fonts = [ (kde5.oxygen-fonts or pkgs.noto-fonts) ]; - - programs.ssh.askPassword = "${kde5.ksshaskpass.out}/bin/ksshaskpass"; - - # Enable helpful DBus services. - services.udisks2.enable = true; - services.upower.enable = config.powerManagement.enable; - - # Extra UDEV rules used by Solid - services.udev.packages = [ - pkgs.libmtp - pkgs.media-player-info - ]; - - services.xserver.displayManager.sddm = { - theme = "breeze"; - themes = [ - kde5.ecm # for the setup-hook - kde5.plasma-workspace - kde5.breeze-icons - ]; - }; - - security.pam.services.kde = { allowNullPassword = true; }; - - }) - ]; - -} diff --git a/nixos/modules/services/x11/desktop-managers/kodi.nix b/nixos/modules/services/x11/desktop-managers/kodi.nix index de00ff93b17c..3ce49b9d2bf8 100644 --- a/nixos/modules/services/x11/desktop-managers/kodi.nix +++ b/nixos/modules/services/x11/desktop-managers/kodi.nix @@ -11,7 +11,6 @@ in services.xserver.desktopManager.kodi = { enable = mkOption { default = false; - example = true; description = "Enable the kodi multimedia center."; }; }; diff --git a/nixos/modules/services/x11/desktop-managers/lumina.nix b/nixos/modules/services/x11/desktop-managers/lumina.nix index f0b31a2acb01..ec5fbb13b323 100644 --- a/nixos/modules/services/x11/desktop-managers/lumina.nix +++ b/nixos/modules/services/x11/desktop-managers/lumina.nix @@ -32,8 +32,8 @@ in environment.systemPackages = [ pkgs.fluxbox - pkgs.kde5.kwindowsystem - pkgs.kde5.oxygen-icons5 + pkgs.libsForQt5.kwindowsystem + pkgs.kdeFrameworks.oxygen-icons5 pkgs.lumina pkgs.numlockx pkgs.qt5.qtsvg diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix new file mode 100644 index 000000000000..2216104be31a --- /dev/null +++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix @@ -0,0 +1,228 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + xcfg = config.services.xserver; + cfg = xcfg.desktopManager.plasma5; + + inherit (pkgs) kdeWrapper kdeApplications plasma5 libsForQt5 qt5 xorg; + +in + +{ + options = { + + services.xserver.desktopManager.plasma5 = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable the Plasma 5 (KDE 5) desktop environment."; + }; + + enableQt4Support = mkOption { + type = types.bool; + default = true; + description = '' + Enable support for Qt 4-based applications. Particularly, install the + Qt 4 version of the Breeze theme and a default backend for Phonon. + ''; + }; + + extraPackages = mkOption { + type = types.listOf types.package; + default = []; + description = '' + KDE packages that need to be installed system-wide. + ''; + }; + + }; + + }; + + + config = mkMerge [ + (mkIf (cfg.extraPackages != []) { + environment.systemPackages = [ (kdeWrapper cfg.extraPackages) ]; + }) + + (mkIf (xcfg.enable && cfg.enable) { + services.xserver.desktopManager.session = singleton { + name = "plasma5"; + bgSupport = true; + start = '' + # Load PulseAudio module for routing support. + # See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/ + ${optionalString config.hardware.pulseaudio.enable '' + ${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1" + ''} + + exec "${plasma5.startkde}" + ''; + }; + + security.wrappers = { + kcheckpass.source = "${plasma5.plasma-workspace.out}/lib/libexec/kcheckpass"; + "start_kdeinit".source = "${pkgs.kinit.out}/lib/libexec/kf5/start_kdeinit"; + }; + + environment.systemPackages = with pkgs; with qt5; with libsForQt5; with plasma5; with kdeApplications; + [ + frameworkintegration + kactivities + kauth + kcmutils + kconfig + kconfigwidgets + kcoreaddons + kdbusaddons + kdeclarative + kded + kdesu + kdnssd + kemoticons + kfilemetadata + kglobalaccel + kguiaddons + kiconthemes + kidletime + kimageformats + kinit + kio + kjobwidgets + knewstuff + knotifications + knotifyconfig + kpackage + kparts + kpeople + krunner + kservice + ktextwidgets + kwallet + kwallet-pam + kwalletmanager + kwayland + kwidgetsaddons + kxmlgui + kxmlrpcclient + plasma-framework + solid + sonnet + threadweaver + + breeze-qt5 + kactivitymanagerd + kde-cli-tools + kdecoration + kdeplasma-addons + kgamma5 + khotkeys + kinfocenter + kmenuedit + kscreen + kscreenlocker + ksysguard + kwayland + kwin + kwrited + libkscreen + libksysguard + milou + plasma-integration + polkit-kde-agent + systemsettings + + plasma-desktop + plasma-workspace + plasma-workspace-wallpapers + + dolphin-plugins + ffmpegthumbs + kdegraphics-thumbnailers + kio-extras + print-manager + + breeze-icons + pkgs.hicolor_icon_theme + + kde-gtk-config breeze-gtk + + phonon-backend-gstreamer + ] + + ++ lib.optionals cfg.enableQt4Support [ breeze-qt4 pkgs.phonon-backend-gstreamer ] + + # Optional hardware support features + ++ lib.optional config.hardware.bluetooth.enable bluedevil + ++ lib.optional config.networking.networkmanager.enable plasma-nm + ++ lib.optional config.hardware.pulseaudio.enable plasma-pa + ++ lib.optional config.powerManagement.enable powerdevil + ++ lib.optional config.services.colord.enable colord-kde + ++ lib.optionals config.services.samba.enable [ kdenetwork-filesharing pkgs.samba ]; + + services.xserver.desktopManager.plasma5.extraPackages = + with kdeApplications; with plasma5; + [ + khelpcenter + oxygen + + dolphin + konsole + ]; + + environment.pathsToLink = [ "/share" ]; + + environment.etc = singleton { + source = xcfg.xkbDir; + target = "X11/xkb"; + }; + + environment.variables = { + # Enable GTK applications to load SVG icons + GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; + QT_PLUGIN_PATH = "/run/current-system/sw/lib/qt5/plugins"; + }; + + fonts.fonts = with pkgs; [ noto-fonts hack-font ]; + fonts.fontconfig.defaultFonts = { + monospace = [ "Hack" "Noto Mono" ]; + sansSerif = [ "Noto Sans" ]; + serif = [ "Noto Serif" ]; + }; + + programs.ssh.askPassword = "${plasma5.ksshaskpass.out}/bin/ksshaskpass"; + + # Enable helpful DBus services. + services.udisks2.enable = true; + services.upower.enable = config.powerManagement.enable; + services.dbus.packages = + mkIf config.services.printing.enable [ pkgs.system-config-printer ]; + + # Extra UDEV rules used by Solid + services.udev.packages = [ + pkgs.libmtp + pkgs.media-player-info + ]; + + services.xserver.displayManager.sddm = { + theme = "breeze"; + package = pkgs.sddmPlasma5; + }; + + security.pam.services.kde = { allowNullPassword = true; }; + + # Doing these one by one seems silly, but we currently lack a better + # construct for handling common pam configs. + security.pam.services.gdm.enableKwallet = true; + security.pam.services.kdm.enableKwallet = true; + security.pam.services.lightdm.enableKwallet = true; + security.pam.services.sddm.enableKwallet = true; + security.pam.services.slim.enableKwallet = true; + + }) + ]; + +} diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix index 530468be5f96..9c42dc8781b9 100644 --- a/nixos/modules/services/x11/desktop-managers/xfce.nix +++ b/nixos/modules/services/x11/desktop-managers/xfce.nix @@ -41,6 +41,18 @@ in Shell commands executed just before XFCE is started. ''; }; + + enableXfwm = mkOption { + type = types.bool; + default = true; + description = "Enable the XFWM (default) window manager."; + }; + + screenLock = mkOption { + type = types.enum [ "xscreensaver" "xlockmore" "slock" ]; + default = "xlockmore"; + description = "Application used by XFCE to lock the screen."; + }; }; }; @@ -74,6 +86,7 @@ in pkgs.tango-icon-theme pkgs.shared_mime_info pkgs.which # Needed by the xfce's xinitrc script. + pkgs."${cfg.screenLock}" pkgs.xfce.exo pkgs.xfce.gtk_xfce_engine pkgs.xfce.mousepad @@ -87,7 +100,6 @@ in pkgs.xfce.xfce4volumed pkgs.xfce.xfce4-screenshooter pkgs.xfce.xfconf - pkgs.xfce.xfwm4 # This supplies some "abstract" icons such as # "utilities-terminal" and "accessories-text-editor". pkgs.gnome3.defaultIconTheme @@ -99,6 +111,7 @@ in pkgs.xfce.xfce4_appfinder pkgs.xfce.tumbler # found via dbus ] + ++ optional cfg.enableXfwm pkgs.xfce.xfwm4 ++ optional config.powerManagement.enable pkgs.xfce.xfce4_power_manager ++ optional config.networking.networkmanager.enable pkgs.networkmanagerapplet ++ optionals (!cfg.noDesktop) diff --git a/nixos/modules/services/x11/desktop-managers/xterm.nix b/nixos/modules/services/x11/desktop-managers/xterm.nix index eab914071410..29752ff405e2 100644 --- a/nixos/modules/services/x11/desktop-managers/xterm.nix +++ b/nixos/modules/services/x11/desktop-managers/xterm.nix @@ -13,7 +13,6 @@ in services.xserver.desktopManager.xterm.enable = mkOption { default = true; - example = false; description = "Enable a xterm terminal as a desktop manager."; }; diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index c0daf30d04eb..cf6efb7dae79 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -1,5 +1,5 @@ # This module declares the options to define a *display manager*, the -# program responsible for handling X logins (such as xdm, kdm, gdb, or +# program responsible for handling X logins (such as xdm, gdb, or # SLiM). The display manager allows the user to select a *session # type*. When the user logs in, the display manager starts the # *session script* ("xsession" below) to launch the selected session @@ -24,7 +24,7 @@ let Xft.lcdfilter: lcd${fontconfig.subpixel.lcdfilter} Xft.hinting: ${if fontconfig.hinting.enable then "1" else "0"} Xft.autohint: ${if fontconfig.hinting.autohint then "1" else "0"} - Xft.hintstyle: hint${fontconfig.hinting.style} + Xft.hintstyle: hintslight ''; # file provided by services.xserver.displayManager.session.script @@ -32,6 +32,33 @@ let '' #! ${pkgs.bash}/bin/bash + # Expected parameters: + # $1 = <desktop-manager>+<window-manager> + + # Actual parameters (FIXME): + # SDDM is calling this script like the following: + # $1 = /nix/store/xxx-xsession (= $0) + # $2 = <desktop-manager>+<window-manager> + # SLiM is using the following parameter: + # $1 = /nix/store/xxx-xsession <desktop-manager>+<window-manager> + # LightDM keeps the double quotes: + # $1 = /nix/store/xxx-xsession "<desktop-manager>+<window-manager>" + # The fake/auto display manager doesn't use any parameters and GDM is + # broken. + # If you want to "debug" this script don't print the parameters to stdout + # or stderr because this script will be executed multiple times and the + # output won't be visible in the log when the script is executed for the + # first time (e.g. append them to a file instead)! + + # All of the above cases are handled by the following hack (FIXME). + # Since this line is *very important* for *all display managers* it is + # very important to test changes to the following line with all display + # managers: + if [ "''${1:0:1}" = "/" ]; then eval exec "$1" "$2" ; fi + + # Now it should be safe to assume that the script was called with the + # expected parameters. + ${optionalString cfg.displayManager.logToJournal '' if [ -z "$_DID_SYSTEMD_CAT" ]; then _DID_SYSTEMD_CAT=1 exec ${config.systemd.package}/bin/systemd-cat -t xsession -- "$0" "$@" @@ -55,9 +82,6 @@ let fi ''} - # Handle being called by kdm. - if test "''${1:0:1}" = /; then eval exec "$1"; fi - # Start PulseAudio if enabled. ${optionalString (config.hardware.pulseaudio.enable) '' ${optionalString (!config.hardware.pulseaudio.systemWide) @@ -107,15 +131,16 @@ let fi fi - # The session type is "<desktop-manager> + <window-manager>", so - # extract those. - windowManager="''${sessionType##* + }" + # The session type is "<desktop-manager>+<window-manager>", so + # extract those (see: + # http://wiki.bash-hackers.org/syntax/pe#substring_removal). + windowManager="''${sessionType##*+}" : ''${windowManager:=${cfg.windowManager.default}} - desktopManager="''${sessionType% + *}" + desktopManager="''${sessionType%%+*}" : ''${desktopManager:=${cfg.desktopManager.default}} # Start the window manager. - case $windowManager in + case "$windowManager" in ${concatMapStrings (s: '' (${s.name}) ${s.start} @@ -125,7 +150,7 @@ let esac # Start the desktop manager. - case $desktopManager in + case "$desktopManager" in ${concatMapStrings (s: '' (${s.name}) ${s.start} @@ -142,6 +167,9 @@ let exit 0 ''; + # Desktop Entry Specification: + # - https://standards.freedesktop.org/desktop-entry-spec/latest/ + # - https://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html mkDesktops = names: pkgs.runCommand "desktops" { # trivial derivation preferLocalBuild = true; @@ -155,7 +183,7 @@ let Version=1.0 Type=XSession TryExec=${cfg.displayManager.session.script} - Exec=${cfg.displayManager.session.script} '${n}' + Exec=${cfg.displayManager.session.script} "${n}" X-GDM-BypassXsession=true Name=${n} Comment= @@ -238,7 +266,7 @@ in wm = filter (s: s.manage == "window") list; dm = filter (s: s.manage == "desktop") list; names = flip concatMap dm - (d: map (w: d.name + optionalString (w.name != "none") (" + " + w.name)) + (d: map (w: d.name + optionalString (w.name != "none") ("+" + w.name)) (filter (w: d.name != "none" || w.name != "none") wm)); desktops = mkDesktops names; script = xsession wm dm; diff --git a/nixos/modules/services/x11/display-managers/kdm.nix b/nixos/modules/services/x11/display-managers/kdm.nix deleted file mode 100644 index 04701a1640cc..000000000000 --- a/nixos/modules/services/x11/display-managers/kdm.nix +++ /dev/null @@ -1,158 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - - dmcfg = config.services.xserver.displayManager; - cfg = dmcfg.kdm; - - inherit (pkgs.kde4) kdebase_workspace; - - defaultConfig = - '' - [Shutdown] - HaltCmd=${config.systemd.package}/sbin/shutdown -h now - RebootCmd=${config.systemd.package}/sbin/shutdown -r now - ${optionalString (config.system.boot.loader.id == "grub") '' - BootManager=${if config.boot.loader.grub.version == 2 then "Grub2" else "Grub"} - ''} - - [X-*-Core] - Xrdb=${pkgs.xorg.xrdb}/bin/xrdb - SessionsDirs=${dmcfg.session.desktops} - Session=${dmcfg.session.script} - FailsafeClient=${pkgs.xterm}/bin/xterm - - [X-:*-Core] - ServerCmd=${dmcfg.xserverBin} ${toString dmcfg.xserverArgs} - # KDM calls `rm' somewhere to clean up some temporary directory. - SystemPath=${pkgs.coreutils}/bin - # The default timeout (15) is too short in a heavily loaded boot process. - ServerTimeout=60 - # Needed to prevent the X server from dying on logout and not coming back: - TerminateServer=true - ${optionalString (cfg.setupScript != "") - '' - Setup=${cfg.setupScript} - ''} - - [X-*-Greeter] - HiddenUsers=root,${concatStringsSep "," dmcfg.hiddenUsers} - PluginsLogin=${kdebase_workspace}/lib/kde4/kgreet_classic.so - ${optionalString (cfg.themeDirectory != null) - '' - UseTheme=true - Theme=${cfg.themeDirectory} - '' - } - - ${optionalString (cfg.enableXDMCP) - '' - [Xdmcp] - Enable=true - ''} - ''; - - kdmrc = pkgs.runCommand "kdmrc" - { config = defaultConfig + cfg.extraConfig; - preferLocalBuild = true; - } - '' - echo "$config" > $out - - # The default kdmrc would add "-nolisten tcp", and we already - # have that managed by nixos. Hence the grep. - cat ${kdebase_workspace}/share/config/kdm/kdmrc | grep -v nolisten >> $out - ''; - -in - -{ - - ###### interface - - options = { - - services.xserver.displayManager.kdm = { - - enable = mkOption { - type = types.bool; - default = false; - description = '' - Whether to enable the KDE display manager. - ''; - }; - - enableXDMCP = mkOption { - type = types.bool; - default = false; - description = '' - Whether to enable XDMCP, which allows remote logins. - ''; - }; - - themeDirectory = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - The path to a KDM theme directory. This theme - will be used by the KDM greeter. - ''; - }; - - setupScript = mkOption { - type = types.lines; - default = ""; - description = '' - The path to a KDM setup script. This script is run as root just - before KDM starts. Can be used for setting up - monitors with xrandr, for example. - ''; - }; - - extraConfig = mkOption { - type = types.lines; - default = ""; - description = '' - Options appended to <filename>kdmrc</filename>, the - configuration file of KDM. - ''; - }; - - }; - - }; - - - ###### implementation - - config = mkIf cfg.enable { - - services.xserver.displayManager.slim.enable = false; - - services.xserver.displayManager.job = - { execCmd = - '' - mkdir -m 0755 -p /var/lib/kdm - chown kdm /var/lib/kdm - ${(optionalString (config.system.boot.loader.id == "grub" && config.system.build.grub != null) "PATH=${config.system.build.grub}/sbin:$PATH ") + - "KDEDIRS=/run/current-system/sw exec ${kdebase_workspace}/bin/kdm -config ${kdmrc} -nodaemon -logfile /dev/stderr"} - ''; - logsXsession = true; - }; - - security.pam.services.kde = { allowNullPassword = true; startSession = true; }; - - users.extraUsers = singleton - { name = "kdm"; - uid = config.ids.uids.kdm; - description = "KDM user"; - }; - - environment.systemPackages = - [ pkgs.kde4.kde_wallpapers ]; # contains kdm's default background - - }; - -} diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix index dfda90978b1e..1d5dcb2c7cbe 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix @@ -45,6 +45,7 @@ let theme-name = ${cfg.theme.name} icon-theme-name = ${cfg.iconTheme.name} background = ${ldmcfg.background} + ${cfg.extraConfig} ''; in @@ -103,6 +104,15 @@ in }; + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra configuration that should be put in the lightdm-gtk-greeter.conf + configuration file. + ''; + }; + }; }; diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix index 4afef32aaa47..256bfb9ce3f4 100644 --- a/nixos/modules/services/x11/display-managers/lightdm.nix +++ b/nixos/modules/services/x11/display-managers/lightdm.nix @@ -46,15 +46,13 @@ let [Seat:*] xserver-command = ${xserverWrapper} session-wrapper = ${dmcfg.session.script} - ${optionalString (elem defaultSessionName dmcfg.session.names) '' - user-session = ${defaultSessionName} - ''} ${optionalString cfg.greeter.enable '' greeter-session = ${cfg.greeter.name} ''} ${optionalString cfg.autoLogin.enable '' autologin-user = ${cfg.autoLogin.user} autologin-user-timeout = ${toString cfg.autoLogin.timeout} + autologin-session = ${defaultSessionName} ''} ${cfg.extraSeatDefaults} ''; @@ -63,7 +61,7 @@ let let dm = xcfg.desktopManager.default; wm = xcfg.windowManager.default; - in dm + optionalString (wm != "none") (" + " + wm); + in dm + optionalString (wm != "none") ("+" + wm); in { # Note: the order in which lightdm greeter modules are imported diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix index 6630b8257e4e..2eb7ddcb1ec0 100644 --- a/nixos/modules/services/x11/display-managers/sddm.nix +++ b/nixos/modules/services/x11/display-managers/sddm.nix @@ -9,7 +9,7 @@ let cfg = dmcfg.sddm; xEnv = config.systemd.services."display-manager".environment; - sddm = pkgs.sddm.override { inherit (cfg) themes; }; + sddm = cfg.package; xserverWrapper = pkgs.writeScript "xserver-wrapper" '' #!/bin/sh @@ -59,7 +59,7 @@ let [Autologin] User=${cfg.autoLogin.user} Session=${defaultSessionName}.desktop - Relogin=${if cfg.autoLogin.relogin then "true" else "false"} + Relogin=${boolToString cfg.autoLogin.relogin} ''} ${cfg.extraConfig} @@ -69,7 +69,7 @@ let let dm = xcfg.desktopManager.default; wm = xcfg.windowManager.default; - in dm + optionalString (wm != "none") (" + " + wm); + in dm + optionalString (wm != "none") ("+" + wm); in { @@ -105,11 +105,12 @@ in ''; }; - themes = mkOption { - type = types.listOf types.package; - default = []; + package = mkOption { + type = types.package; + default = pkgs.sddm; description = '' - Extra packages providing themes. + The SDDM package to install. + The default package can be overridden to provide extra themes. ''; }; diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix index 68acde85b5dc..0c4dd1973b53 100644 --- a/nixos/modules/services/x11/display-managers/slim.nix +++ b/nixos/modules/services/x11/display-managers/slim.nix @@ -17,9 +17,11 @@ let login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session" halt_cmd ${config.systemd.package}/sbin/shutdown -h now reboot_cmd ${config.systemd.package}/sbin/shutdown -r now + logfile /dev/stderr ${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)} ${optionalString (cfg.defaultUser != null) ("focus_password yes")} ${optionalString cfg.autoLogin "auto_login yes"} + ${optionalString (cfg.consoleCmd != null) "console_cmd ${cfg.consoleCmd}"} ${cfg.extraConfig} ''; @@ -105,6 +107,18 @@ in ''; }; + consoleCmd = mkOption { + type = types.nullOr types.str; + default = '' + ${pkgs.xterm}/bin/xterm -C -fg white -bg black +sb -T "Console login" -e ${pkgs.shadow}/bin/login + ''; + defaultText = '' + ''${pkgs.xterm}/bin/xterm -C -fg white -bg black +sb -T "Console login" -e ''${pkgs.shadow}/bin/login + ''; + description = '' + The command to run when "console" is given as the username. + ''; + }; }; }; @@ -115,11 +129,7 @@ in config = mkIf cfg.enable { services.xserver.displayManager.job = - { preStart = - '' - rm -f /var/log/slim.log - ''; - environment = + { environment = { SLIM_CFGFILE = slimConfig; SLIM_THEMESDIR = slimThemesDir; }; diff --git a/nixos/modules/services/x11/display-managers/xpra.nix b/nixos/modules/services/x11/display-managers/xpra.nix new file mode 100644 index 000000000000..e60dd8765264 --- /dev/null +++ b/nixos/modules/services/x11/display-managers/xpra.nix @@ -0,0 +1,249 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.xserver.displayManager.xpra; + dmcfg = config.services.xserver.displayManager; + +in + +{ + ###### interface + + options = { + services.xserver.displayManager.xpra = { + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable xpra as display manager."; + }; + + bindTcp = mkOption { + default = "127.0.0.1:10000"; + example = "0.0.0.0:10000"; + type = types.nullOr types.str; + description = "Bind xpra to TCP"; + }; + + auth = mkOption { + type = types.str; + default = "pam"; + example = "password:value=mysecret"; + description = "Authentication to use when connecting to xpra"; + }; + + pulseaudio = mkEnableOption "pulseaudio audio streaming."; + }; + }; + + ###### implementation + + config = mkIf cfg.enable { + services.xserver.videoDrivers = ["dummy"]; + + services.xserver.monitorSection = '' + HorizSync 1.0 - 2000.0 + VertRefresh 1.0 - 200.0 + #To add your own modes here, use a modeline calculator, like: + # cvt: + # http://www.x.org/archive/X11R7.5/doc/man/man1/cvt.1.html + # xtiming: + # http://xtiming.sourceforge.net/cgi-bin/xtiming.pl + # gtf: + # http://gtf.sourceforge.net/ + #This can be used to get a specific DPI, but only for the default resolution: + #DisplaySize 508 317 + #NOTE: the highest modes will not work without increasing the VideoRam + # for the dummy video card. + #Modeline "16000x15000" 300.00 16000 16408 18000 20000 15000 15003 15013 15016 + #Modeline "15000x15000" 281.25 15000 15376 16872 18744 15000 15003 15013 15016 + #Modeline "16384x8192" 167.75 16384 16800 18432 20480 8192 8195 8205 8208 + #Modeline "15360x8640" 249.00 15360 15752 17280 19200 8640 8643 8648 8651 + Modeline "8192x4096" 193.35 8192 8224 8952 8984 4096 4196 4200 4301 + Modeline "7680x4320" 208.00 7680 7880 8640 9600 4320 4323 4328 4335 + Modeline "6400x4096" 151.38 6400 6432 7000 7032 4096 4196 4200 4301 + Modeline "6400x2560" 91.59 6400 6432 6776 6808 2560 2623 2626 2689 + Modeline "6400x2160" 160.51 6400 6432 7040 7072 2160 2212 2216 2269 + Modeline "5760x2160" 149.50 5760 5768 6320 6880 2160 2161 2164 2173 + Modeline "5680x1440" 142.66 5680 5712 6248 6280 1440 1474 1478 1513 + Modeline "5496x1200" 199.13 5496 5528 6280 6312 1200 1228 1233 1261 + Modeline "5280x2560" 75.72 5280 5312 5592 5624 2560 2623 2626 2689 + Modeline "5280x1920" 56.04 5280 5312 5520 5552 1920 1967 1969 2017 + Modeline "5280x1200" 191.40 5280 5312 6032 6064 1200 1228 1233 1261 + Modeline "5280x1080" 169.96 5280 5312 5952 5984 1080 1105 1110 1135 + Modeline "5120x3200" 199.75 5120 5152 5904 5936 3200 3277 3283 3361 + Modeline "5120x2560" 73.45 5120 5152 5424 5456 2560 2623 2626 2689 + Modeline "5120x2880" 185.50 5120 5256 5760 6400 2880 2883 2888 2899 + Modeline "4800x1200" 64.42 4800 4832 5072 5104 1200 1229 1231 1261 + Modeline "4720x3840" 227.86 4720 4752 5616 5648 3840 3933 3940 4033 + Modeline "4400x2560" 133.70 4400 4432 4936 4968 2560 2622 2627 2689 + Modeline "4480x1440" 72.94 4480 4512 4784 4816 1440 1475 1478 1513 + Modeline "4240x1440" 69.09 4240 4272 4528 4560 1440 1475 1478 1513 + Modeline "4160x1440" 67.81 4160 4192 4448 4480 1440 1475 1478 1513 + Modeline "4096x2304" 249.25 4096 4296 4720 5344 2304 2307 2312 2333 + Modeline "4096x2160" 111.25 4096 4200 4608 5120 2160 2163 2173 2176 + Modeline "4000x1660" 170.32 4000 4128 4536 5072 1660 1661 1664 1679 + Modeline "4000x1440" 145.00 4000 4088 4488 4976 1440 1441 1444 1457 + Modeline "3904x1440" 63.70 3904 3936 4176 4208 1440 1475 1478 1513 + Modeline "3840x2880" 133.43 3840 3872 4376 4408 2880 2950 2955 3025 + Modeline "3840x2560" 116.93 3840 3872 4312 4344 2560 2622 2627 2689 + Modeline "3840x2160" 104.25 3840 3944 4320 4800 2160 2163 2168 2175 + Modeline "3840x2048" 91.45 3840 3872 4216 4248 2048 2097 2101 2151 + Modeline "3840x1200" 108.89 3840 3872 4280 4312 1200 1228 1232 1261 + Modeline "3840x1080" 100.38 3840 3848 4216 4592 1080 1081 1084 1093 + Modeline "3864x1050" 94.58 3864 3896 4248 4280 1050 1074 1078 1103 + Modeline "3600x1200" 106.06 3600 3632 3984 4368 1200 1201 1204 1214 + Modeline "3600x1080" 91.02 3600 3632 3976 4008 1080 1105 1109 1135 + Modeline "3520x1196" 99.53 3520 3552 3928 3960 1196 1224 1228 1256 + Modeline "3360x2560" 102.55 3360 3392 3776 3808 2560 2622 2627 2689 + Modeline "3360x1050" 293.75 3360 3576 3928 4496 1050 1053 1063 1089 + Modeline "3288x1080" 39.76 3288 3320 3464 3496 1080 1106 1108 1135 + Modeline "3200x1800" 233.00 3200 3384 3720 4240 1800 1803 1808 1834 + Modeline "3200x1080" 236.16 3200 3232 4128 4160 1080 1103 1112 1135 + Modeline "3120x2560" 95.36 3120 3152 3512 3544 2560 2622 2627 2689 + Modeline "3120x1050" 272.75 3120 3320 3648 4176 1050 1053 1063 1089 + Modeline "3072x2560" 93.92 3072 3104 3456 3488 2560 2622 2627 2689 + Modeline "3008x1692" 130.93 3008 3112 3416 3824 1692 1693 1696 1712 + Modeline "3000x2560" 91.77 3000 3032 3376 3408 2560 2622 2627 2689 + Modeline "2880x1620" 396.25 2880 3096 3408 3936 1620 1623 1628 1679 + Modeline "2728x1680" 148.02 2728 2760 3320 3352 1680 1719 1726 1765 + Modeline "2560x2240" 151.55 2560 2688 2952 3344 2240 2241 2244 2266 + Modeline "2560x1600" 47.12 2560 2592 2768 2800 1600 1639 1642 1681 + Modeline "2560x1440" 42.12 2560 2592 2752 2784 1440 1475 1478 1513 + Modeline "2560x1400" 267.86 2560 2592 3608 3640 1400 1429 1441 1471 + Modeline "2048x2048" 49.47 2048 2080 2264 2296 2048 2097 2101 2151 + Modeline "2048x1536" 80.06 2048 2104 2312 2576 1536 1537 1540 1554 + Modeline "2048x1152" 197.97 2048 2184 2408 2768 1152 1153 1156 1192 + Modeline "2048x1152" 165.92 2048 2080 2704 2736 1152 1176 1186 1210 + Modeline "1920x1440" 69.47 1920 1960 2152 2384 1440 1441 1444 1457 + Modeline "1920x1200" 26.28 1920 1952 2048 2080 1200 1229 1231 1261 + Modeline "1920x1080" 23.53 1920 1952 2040 2072 1080 1106 1108 1135 + Modeline "1728x1520" 205.42 1728 1760 2536 2568 1520 1552 1564 1597 + Modeline "1680x1050" 20.08 1680 1712 1784 1816 1050 1075 1077 1103 + Modeline "1600x1200" 22.04 1600 1632 1712 1744 1200 1229 1231 1261 + Modeline "1600x900" 33.92 1600 1632 1760 1792 900 921 924 946 + Modeline "1440x900" 30.66 1440 1472 1584 1616 900 921 924 946 + Modeline "1400x900" 103.50 1400 1480 1624 1848 900 903 913 934 + ModeLine "1366x768" 72.00 1366 1414 1446 1494 768 771 777 803 + Modeline "1360x768" 24.49 1360 1392 1480 1512 768 786 789 807 + Modeline "1280x1024" 31.50 1280 1312 1424 1456 1024 1048 1052 1076 + Modeline "1280x800" 24.15 1280 1312 1400 1432 800 819 822 841 + Modeline "1280x768" 23.11 1280 1312 1392 1424 768 786 789 807 + Modeline "1280x720" 59.42 1280 1312 1536 1568 720 735 741 757 + Modeline "1024x768" 18.71 1024 1056 1120 1152 768 786 789 807 + Modeline "1024x640" 41.98 1024 1056 1208 1240 640 653 659 673 + Modeline "1024x576" 46.50 1024 1064 1160 1296 576 579 584 599 + Modeline "768x1024" 19.50 768 800 872 904 1024 1048 1052 1076 + Modeline "960x540" 40.75 960 992 1088 1216 540 543 548 562 + Modeline "864x486" 32.50 864 888 968 1072 486 489 494 506 + Modeline "720x405" 22.50 720 744 808 896 405 408 413 422 + Modeline "640x360" 14.75 640 664 720 800 360 363 368 374 + #common resolutions for android devices (both orientations): + Modeline "800x1280" 25.89 800 832 928 960 1280 1310 1315 1345 + Modeline "1280x800" 24.15 1280 1312 1400 1432 800 819 822 841 + Modeline "720x1280" 30.22 720 752 864 896 1280 1309 1315 1345 + Modeline "1280x720" 27.41 1280 1312 1416 1448 720 737 740 757 + Modeline "768x1024" 24.93 768 800 888 920 1024 1047 1052 1076 + Modeline "1024x768" 23.77 1024 1056 1144 1176 768 785 789 807 + Modeline "600x1024" 19.90 600 632 704 736 1024 1047 1052 1076 + Modeline "1024x600" 18.26 1024 1056 1120 1152 600 614 617 631 + Modeline "536x960" 16.74 536 568 624 656 960 982 986 1009 + Modeline "960x536" 15.23 960 992 1048 1080 536 548 551 563 + Modeline "600x800" 15.17 600 632 688 720 800 818 822 841 + Modeline "800x600" 14.50 800 832 880 912 600 614 617 631 + Modeline "480x854" 13.34 480 512 560 592 854 873 877 897 + Modeline "848x480" 12.09 848 880 920 952 480 491 493 505 + Modeline "480x800" 12.43 480 512 552 584 800 818 822 841 + Modeline "800x480" 11.46 800 832 872 904 480 491 493 505 + #resolutions for android devices (both orientations) + #minus the status bar + #38px status bar (and width rounded up) + Modeline "800x1242" 25.03 800 832 920 952 1242 1271 1275 1305 + Modeline "1280x762" 22.93 1280 1312 1392 1424 762 780 783 801 + Modeline "720x1242" 29.20 720 752 856 888 1242 1271 1276 1305 + Modeline "1280x682" 25.85 1280 1312 1408 1440 682 698 701 717 + Modeline "768x986" 23.90 768 800 888 920 986 1009 1013 1036 + Modeline "1024x730" 22.50 1024 1056 1136 1168 730 747 750 767 + Modeline "600x986" 19.07 600 632 704 736 986 1009 1013 1036 + Modeline "1024x562" 17.03 1024 1056 1120 1152 562 575 578 591 + Modeline "536x922" 16.01 536 568 624 656 922 943 947 969 + Modeline "960x498" 14.09 960 992 1040 1072 498 509 511 523 + Modeline "600x762" 14.39 600 632 680 712 762 779 783 801 + Modeline "800x562" 13.52 800 832 880 912 562 575 578 591 + Modeline "480x810" 12.59 480 512 552 584 810 828 832 851 + Modeline "848x442" 11.09 848 880 920 952 442 452 454 465 + Modeline "480x762" 11.79 480 512 552 584 762 779 783 801 + ''; + + services.xserver.resolutions = [ + {x="8192"; y="4096";} + {x="5120"; y="3200";} + {x="3840"; y="2880";} + {x="3840"; y="2560";} + {x="3840"; y="2048";} + {x="3840"; y="2160";} + {x="2048"; y="2048";} + {x="2560"; y="1600";} + {x="1920"; y="1440";} + {x="1920"; y="1200";} + {x="1920"; y="1080";} + {x="1600"; y="1200";} + {x="1680"; y="1050";} + {x="1600"; y="900";} + {x="1400"; y="1050";} + {x="1440"; y="900";} + {x="1280"; y="1024";} + {x="1366"; y="768";} + {x="1280"; y="800";} + {x="1024"; y="768";} + {x="1024"; y="600";} + {x="800"; y="600";} + {x="320"; y="200";} + ]; + + services.xserver.serverFlagsSection = '' + Option "DontVTSwitch" "true" + Option "PciForceNone" "true" + Option "AutoEnableDevices" "false" + Option "AutoAddDevices" "false" + ''; + + services.xserver.deviceSection = '' + VideoRam 192000 + ''; + + services.xserver.displayManager.job = { + logsXsession = true; + + execCmd = '' + ${optionalString (cfg.pulseaudio) + "export PULSE_COOKIE=/var/run/pulse/.config/pulse/cookie"} + exec ${pkgs.xpra}/bin/xpra start \ + --daemon=off \ + --log-dir=/var/log \ + --log-file=xpra.log \ + --opengl=on \ + --clipboard=on \ + --notifications=on \ + --speaker=yes \ + --mdns=no \ + --pulseaudio=no \ + ${optionalString (cfg.pulseaudio) "--sound-source=pulse"} \ + --socket-dirs=/var/run/xpra \ + --xvfb="xpra_Xdummy ${concatStringsSep " " dmcfg.xserverArgs}" \ + ${optionalString (cfg.bindTcp != null) "--bind-tcp=${cfg.bindTcp}"} \ + --auth=${cfg.auth} + ''; + }; + + services.xserver.terminateOnReset = false; + + environment.systemPackages = [pkgs.xpra]; + + virtualisation.virtualbox.guest.x11 = false; + hardware.pulseaudio.enable = mkDefault cfg.pulseaudio; + hardware.pulseaudio.systemWide = mkDefault cfg.pulseaudio; + }; + +} diff --git a/nixos/modules/services/x11/hardware/libinput.nix b/nixos/modules/services/x11/hardware/libinput.nix index b358550ba41d..d75c785270b3 100644 --- a/nixos/modules/services/x11/hardware/libinput.nix +++ b/nixos/modules/services/x11/hardware/libinput.nix @@ -73,7 +73,6 @@ in { clickMethod = mkOption { type = types.nullOr (types.enum [ "none" "buttonareas" "clickfinger" ]); default = null; - example = "none"; description = '' Enables a click method. Permitted values are none, buttonareas, clickfinger. @@ -85,14 +84,12 @@ in { leftHanded = mkOption { type = types.bool; default = false; - example = true; description = "Enables left-handed button orientation, i.e. swapping left and right buttons."; }; middleEmulation = mkOption { type = types.bool; default = true; - example = false; description = '' Enables middle button emulation. When enabled, pressing the left and right buttons @@ -103,7 +100,6 @@ in { naturalScrolling = mkOption { type = types.bool; default = false; - example = true; description = "Enables or disables natural scrolling behavior."; }; @@ -131,7 +127,6 @@ in { horizontalScrolling = mkOption { type = types.bool; default = true; - example = false; description = '' Disables horizontal scrolling. When disabled, this driver will discard any horizontal scroll @@ -153,7 +148,6 @@ in { tapping = mkOption { type = types.bool; default = true; - example = false; description = '' Enables or disables tap-to-click behavior. @@ -163,7 +157,6 @@ in { tappingDragLock = mkOption { type = types.bool; default = true; - example = false; description = '' Enables or disables drag lock during tapping behavior. When enabled, a finger up during tap- @@ -175,7 +168,6 @@ in { disableWhileTyping = mkOption { type = types.bool; default = true; - example = false; description = '' Disable input method while typing. diff --git a/nixos/modules/services/x11/hardware/multitouch.nix b/nixos/modules/services/x11/hardware/multitouch.nix index f8386b5e333b..c03bb3b494fb 100644 --- a/nixos/modules/services/x11/hardware/multitouch.nix +++ b/nixos/modules/services/x11/hardware/multitouch.nix @@ -18,20 +18,17 @@ in { enable = mkOption { default = false; - example = true; description = "Whether to enable multitouch touchpad support."; }; invertScroll = mkOption { default = false; - example = true; type = types.bool; description = "Whether to invert scrolling direction à la OSX Lion"; }; ignorePalm = mkOption { default = false; - example = true; type = types.bool; description = "Whether to ignore touches detected as being the palm (i.e when typing)"; }; @@ -39,7 +36,6 @@ in { tapButtons = mkOption { type = types.bool; default = true; - example = false; description = "Whether to enable tap buttons."; }; @@ -78,7 +74,7 @@ in { MatchIsTouchpad "on" Identifier "Touchpads" Driver "mtrack" - Option "IgnorePalm" "${if cfg.ignorePalm then "true" else "false"}" + Option "IgnorePalm" "${boolToString cfg.ignorePalm}" Option "ClickFinger1" "${builtins.elemAt cfg.buttonsMap 0}" Option "ClickFinger2" "${builtins.elemAt cfg.buttonsMap 1}" Option "ClickFinger3" "${builtins.elemAt cfg.buttonsMap 2}" diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix index 2a7f4e5cbcd1..54454c736c1d 100644 --- a/nixos/modules/services/x11/hardware/synaptics.nix +++ b/nixos/modules/services/x11/hardware/synaptics.nix @@ -29,7 +29,6 @@ in { enable = mkOption { type = types.bool; default = false; - example = true; description = "Whether to enable touchpad support."; }; @@ -102,7 +101,6 @@ in { tapButtons = mkOption { type = types.bool; default = true; - example = false; description = "Whether to enable tap buttons."; }; @@ -125,7 +123,6 @@ in { palmDetect = mkOption { type = types.bool; default = false; - example = true; description = "Whether to enable palm detection (hardware support required)"; }; @@ -146,7 +143,6 @@ in { horizontalScroll = mkOption { type = types.bool; default = true; - example = false; description = "Whether to enable horizontal scrolling (on touchpad)"; }; diff --git a/nixos/modules/services/x11/redshift.nix b/nixos/modules/services/x11/redshift.nix index 78a97df98775..eb5dfdf95849 100644 --- a/nixos/modules/services/x11/redshift.nix +++ b/nixos/modules/services/x11/redshift.nix @@ -12,7 +12,6 @@ in { enable = mkOption { type = types.bool; default = false; - example = true; description = '' Enable Redshift to change your screen's colour temperature depending on the time of day. diff --git a/nixos/modules/services/x11/terminal-server.nix b/nixos/modules/services/x11/terminal-server.nix index 785394d9648c..09a7f386876f 100644 --- a/nixos/modules/services/x11/terminal-server.nix +++ b/nixos/modules/services/x11/terminal-server.nix @@ -16,18 +16,8 @@ with lib; services.xserver.enable = true; services.xserver.videoDrivers = []; - # Enable KDM. Any display manager will do as long as it supports XDMCP. - services.xserver.displayManager.kdm.enable = true; - services.xserver.displayManager.kdm.enableXDMCP = true; - services.xserver.displayManager.kdm.extraConfig = - '' - [General] - # We're headless, so don't bother starting an X server. - StaticServers= - - [Xdmcp] - Xaccess=${pkgs.writeText "Xaccess" "localhost"} - ''; + # Enable GDM. Any display manager will do as long as it supports XDMCP. + services.xserver.displayManager.gdm.enable = true; systemd.sockets.terminal-server = { description = "Terminal Server Socket"; diff --git a/nixos/modules/services/x11/unclutter-xfixes.nix b/nixos/modules/services/x11/unclutter-xfixes.nix index bd02c5ed9895..b94dfb1a26a6 100644 --- a/nixos/modules/services/x11/unclutter-xfixes.nix +++ b/nixos/modules/services/x11/unclutter-xfixes.nix @@ -11,7 +11,6 @@ in { description = "Enable unclutter-xfixes to hide your mouse cursor when inactive."; type = types.bool; default = false; - example = true; }; package = mkOption { diff --git a/nixos/modules/services/x11/unclutter.nix b/nixos/modules/services/x11/unclutter.nix index ebc195d108d0..a22e5ac2c95a 100644 --- a/nixos/modules/services/x11/unclutter.nix +++ b/nixos/modules/services/x11/unclutter.nix @@ -11,7 +11,6 @@ in { description = "Enable unclutter to hide your mouse cursor when inactive"; type = types.bool; default = false; - example = true; }; package = mkOption { @@ -61,7 +60,10 @@ in { serviceConfig.ExecStart = '' ${cfg.package}/bin/unclutter \ -idle ${toString cfg.timeout} \ - -display :${toString config.services.xserver.display} \ + -display :${toString ( + let display = config.services.xserver.display; + in if display != null then display else 0 + )} \ -jitter ${toString (cfg.threeshold - 1)} \ ${optionalString cfg.keystroke "-keystroke"} \ ${concatMapStrings (x: " -"+x) cfg.extraOptions} \ diff --git a/nixos/modules/services/x11/urxvtd.nix b/nixos/modules/services/x11/urxvtd.nix index be36efaa5897..57ad93f20174 100644 --- a/nixos/modules/services/x11/urxvtd.nix +++ b/nixos/modules/services/x11/urxvtd.nix @@ -11,7 +11,6 @@ in { options.services.urxvtd.enable = mkOption { type = types.bool; default = false; - example = true; description = '' Enable urxvtd, the urxvt terminal daemon. To use urxvtd, run "urxvtc". diff --git a/nixos/modules/services/x11/window-managers/2bwm.nix b/nixos/modules/services/x11/window-managers/2bwm.nix new file mode 100644 index 000000000000..e3f5ec7dbe67 --- /dev/null +++ b/nixos/modules/services/x11/window-managers/2bwm.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.xserver.windowManager."2bwm"; + +in + +{ + + ###### interface + + options = { + services.xserver.windowManager."2bwm".enable = mkEnableOption "2bwm"; + }; + + + ###### implementation + + config = mkIf cfg.enable { + + services.xserver.windowManager.session = singleton + { name = "2bwm"; + start = + '' + ${pkgs."2bwm"}/bin/2bwm & + waitPID=$! + ''; + }; + + environment.systemPackages = [ pkgs."2bwm" ]; + + }; + +} diff --git a/nixos/modules/services/x11/window-managers/default.nix b/nixos/modules/services/x11/window-managers/default.nix index f005decfa33c..32ef34bdad2b 100644 --- a/nixos/modules/services/x11/window-managers/default.nix +++ b/nixos/modules/services/x11/window-managers/default.nix @@ -8,12 +8,14 @@ in { imports = [ + ./2bwm.nix ./afterstep.nix ./bspwm.nix ./compiz.nix ./dwm.nix ./exwm.nix ./fluxbox.nix + ./fvwm.nix ./herbstluftwm.nix ./i3.nix ./jwm.nix diff --git a/nixos/modules/services/x11/window-managers/exwm.nix b/nixos/modules/services/x11/window-managers/exwm.nix index dbbd8a125d66..dc1d957c1709 100644 --- a/nixos/modules/services/x11/window-managers/exwm.nix +++ b/nixos/modules/services/x11/window-managers/exwm.nix @@ -21,7 +21,6 @@ in enable = mkEnableOption "exwm"; enableDefaultConfig = mkOption { default = true; - example = false; type = lib.types.bool; description = "Enable an uncustomised exwm configuration."; }; diff --git a/nixos/modules/services/x11/window-managers/fvwm.nix b/nixos/modules/services/x11/window-managers/fvwm.nix new file mode 100644 index 000000000000..9a51b9cd6602 --- /dev/null +++ b/nixos/modules/services/x11/window-managers/fvwm.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.xserver.windowManager.fvwm; + fvwm = pkgs.fvwm.override { gestures = cfg.gestures; }; +in + +{ + + ###### interface + + options = { + services.xserver.windowManager.fvwm = { + enable = mkEnableOption "Fvwm window manager"; + + gestures = mkOption { + default = false; + type = types.bool; + description = "Whether or not to enable libstroke for gesture support"; + }; + }; + }; + + + ###### implementation + + config = mkIf cfg.enable { + services.xserver.windowManager.session = singleton + { name = "fvwm"; + start = + '' + ${fvwm}/bin/fvwm & + waitPID=$! + ''; + }; + + environment.systemPackages = [ fvwm ]; + }; +} diff --git a/nixos/modules/services/x11/window-managers/herbstluftwm.nix b/nixos/modules/services/x11/window-managers/herbstluftwm.nix index 829935fa432b..e3ea61cb9a6b 100644 --- a/nixos/modules/services/x11/window-managers/herbstluftwm.nix +++ b/nixos/modules/services/x11/window-managers/herbstluftwm.nix @@ -8,15 +8,30 @@ in { options = { - services.xserver.windowManager.herbstluftwm.enable = mkEnableOption "herbstluftwm"; + services.xserver.windowManager.herbstluftwm = { + enable = mkEnableOption "herbstluftwm"; + + configFile = mkOption { + default = null; + type = with types; nullOr path; + description = '' + Path to the herbstluftwm configuration file. If left at the + default value, $XDG_CONFIG_HOME/herbstluftwm/autostart will + be used. + ''; + }; + }; }; config = mkIf cfg.enable { services.xserver.windowManager.session = singleton { name = "herbstluftwm"; - start = " - ${pkgs.herbstluftwm}/bin/herbstluftwm - "; + start = + let configFileClause = optionalString + (cfg.configFile != null) + ''-c "${cfg.configFile}"'' + ; + in "${pkgs.herbstluftwm}/bin/herbstluftwm ${configFileClause}"; }; environment.systemPackages = [ pkgs.herbstluftwm ]; }; diff --git a/nixos/modules/services/x11/window-managers/xmonad.nix b/nixos/modules/services/x11/window-managers/xmonad.nix index 6af88d4f645b..e25a8ae22823 100644 --- a/nixos/modules/services/x11/window-managers/xmonad.nix +++ b/nixos/modules/services/x11/window-managers/xmonad.nix @@ -44,7 +44,6 @@ in enableContribAndExtras = mkOption { default = false; - example = true; type = lib.types.bool; description = "Enable xmonad-{contrib,extras} in Xmonad."; }; diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index f5ed52338182..262115b39e79 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -258,7 +258,7 @@ in type = types.str; default = "us"; description = '' - Keyboard layout. + Keyboard layout, or multiple keyboard layouts separated by commas. ''; }; @@ -435,6 +435,14 @@ in by default. ''; }; + + terminateOnReset = mkOption { + type = types.bool; + default = true; + description = '' + Whether to terminate X upon server reset. + ''; + }; }; }; @@ -459,6 +467,8 @@ in knownVideoDrivers; in optional (driver != null) ({ inherit name; modules = []; driverName = name; } // driver)); + nixpkgs.config.xorg = optionalAttrs (elem "vboxvideo" cfg.videoDrivers) { abiCompat = "1.18"; }; + assertions = [ { assertion = config.security.polkit.enable; message = "X11 requires Polkit to be enabled (‘security.polkit.enable = true’)."; @@ -548,8 +558,7 @@ in }; services.xserver.displayManager.xserverArgs = - [ "-terminate" - "-config ${configFile}" + [ "-config ${configFile}" "-xkbdir" "${cfg.xkbDir}" # Log at the default verbosity level to stderr rather than /var/log/X.*.log. "-verbose" "3" "-logfile" "/dev/null" @@ -558,7 +567,8 @@ in ++ optional (cfg.dpi != null) "-dpi ${toString cfg.dpi}" ++ optional (!cfg.enableTCP) "-nolisten tcp" ++ optional (cfg.autoRepeatDelay != null) "-ardelay ${toString cfg.autoRepeatDelay}" - ++ optional (cfg.autoRepeatInterval != null) "-arinterval ${toString cfg.autoRepeatInterval}"; + ++ optional (cfg.autoRepeatInterval != null) "-arinterval ${toString cfg.autoRepeatInterval}" + ++ optional cfg.terminateOnReset "-terminate"; services.xserver.modules = concatLists (catAttrs "modules" cfg.drivers) ++ @@ -568,6 +578,35 @@ in services.xserver.xkbDir = mkDefault "${pkgs.xkeyboard_config}/etc/X11/xkb"; + system.extraDependencies = [ + (pkgs.runCommand "xkb-layouts-exist" { + layouts=cfg.layout; + } '' + missing=() + while read -d , layout + do + [[ -f "${cfg.xkbDir}/symbols/$layout" ]] || missing+=($layout) + done <<< "$layouts," + if [[ ''${#missing[@]} -eq 0 ]] + then + touch $out + exit 0 + fi + + cat >&2 <<EOF + + Some of the selected keyboard layouts do not exist: + + ''${missing[@]} + + Set services.xserver.layout to the name of an existing keyboard + layout (check ${cfg.xkbDir}/symbols for options). + + EOF + exit -1 + '') + ]; + services.xserver.config = '' Section "ServerFlags" |