diff options
Diffstat (limited to 'nixpkgs/nixos/modules/services/x11/desktop-managers')
12 files changed, 1106 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix new file mode 100644 index 000000000000..cce35aa28ba8 --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/default.nix @@ -0,0 +1,113 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + xcfg = config.services.xserver; + cfg = xcfg.desktopManager; + + # If desktop manager `d' isn't capable of setting a background and + # the xserver is enabled, `feh' or `xsetroot' are used as a fallback. + needBGCond = d: ! (d ? bgSupport && d.bgSupport) && xcfg.enable; + +in + +{ + # Note: the order in which desktop manager modules are imported here + # determines the default: later modules (if enabled) are preferred. + # E.g., if Plasma 5 is enabled, it supersedes xterm. + imports = [ + ./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix + ./lxqt.nix ./enlightenment.nix ./gnome3.nix ./kodi.nix ./maxx.nix + ./mate.nix + ]; + + options = { + + 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; + }; + + }; + + }; + + config.services.xserver.displayManager.session = cfg.session.list; +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/enlightenment.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/enlightenment.nix new file mode 100644 index 000000000000..04e380b61530 --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/enlightenment.nix @@ -0,0 +1,104 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + + e = pkgs.enlightenment; + xcfg = config.services.xserver; + cfg = xcfg.desktopManager.enlightenment; + GST_PLUGIN_PATH = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" [ + pkgs.gst_all_1.gst-plugins-base + pkgs.gst_all_1.gst-plugins-good + pkgs.gst_all_1.gst-plugins-bad + pkgs.gst_all_1.gst-libav ]; + +in + +{ + options = { + + services.xserver.desktopManager.enlightenment.enable = mkOption { + default = false; + description = "Enable the Enlightenment desktop environment."; + }; + + }; + + config = mkIf (xcfg.enable && cfg.enable) { + + environment.systemPackages = [ + e.efl e.enlightenment + e.terminology e.econnman + pkgs.xorg.xauth # used by kdesu + pkgs.gtk2 # To get GTK+'s themes. + pkgs.tango-icon-theme + + pkgs.gnome2.gnomeicontheme + pkgs.xorg.xcursorthemes + ]; + + environment.pathsToLink = [ + "/etc/enlightenment" + "/share/enlightenment" + "/share/elementary" + "/share/locale" + ]; + + services.xserver.desktopManager.session = [ + { name = "Enlightenment"; + start = '' + # Set GTK_DATA_PREFIX so that GTK+ can find the themes + export GTK_DATA_PREFIX=${config.system.path} + # find theme engines + export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0 + export XDG_MENU_PREFIX=e- + + export GST_PLUGIN_PATH="${GST_PLUGIN_PATH}" + + # make available for D-BUS user services + #export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}:${config.system.path}/share:${e.efl}/share + + # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/ + ${pkgs.xdg-user-dirs}/bin/xdg-user-dirs-update + + exec ${e.enlightenment}/bin/enlightenment_start + ''; + }]; + + security.wrappers = (import "${e.enlightenment}/e-wrappers.nix").security.wrappers; + + environment.etc = singleton + { source = xcfg.xkbDir; + target = "X11/xkb"; + }; + + fonts.fonts = [ pkgs.dejavu_fonts pkgs.ubuntu_font_family ]; + + services.udisks2.enable = true; + services.upower.enable = config.powerManagement.enable; + + services.dbus.packages = [ e.efl ]; + + systemd.user.services.efreet = + { enable = true; + description = "org.enlightenment.Efreet"; + serviceConfig = + { ExecStart = "${e.efl}/bin/efreetd"; + StandardOutput = "null"; + }; + }; + + systemd.user.services.ethumb = + { enable = true; + description = "org.enlightenment.Ethumb"; + serviceConfig = + { ExecStart = "${e.efl}/bin/ethumbd"; + StandardOutput = "null"; + }; + }; + + + }; + +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix new file mode 100644 index 000000000000..ba6d333b534e --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -0,0 +1,187 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.xserver.desktopManager.gnome3; + + # Remove packages of ys from xs, based on their names + removePackagesByName = xs: ys: + let + pkgName = drv: (builtins.parseDrvName drv.name).name; + ysNames = map pkgName ys; + in + filter (x: !(builtins.elem (pkgName x) ysNames)) xs; + + # Prioritize nautilus by default when opening directories + mimeAppsList = pkgs.writeTextFile { + name = "gnome-mimeapps"; + destination = "/share/applications/mimeapps.list"; + text = '' + [Default Applications] + inode/directory=nautilus.desktop;org.gnome.Nautilus.desktop + ''; + }; + + nixos-gsettings-desktop-schemas = pkgs.runCommand "nixos-gsettings-desktop-schemas" {} + '' + mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas + cp -rf ${pkgs.gnome3.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas + + ${concatMapStrings (pkg: "cp -rf ${pkg}/share/gsettings-schemas/*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas\n") cfg.extraGSettingsOverridePackages} + + chmod -R a+w $out/share/gsettings-schemas/nixos-gsettings-overrides + cat - > $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF + [org.gnome.desktop.background] + picture-uri='${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/artwork/gnome/nix-wallpaper-simple-dark-gray.png' + + [org.gnome.desktop.screensaver] + picture-uri='${pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom}/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png' + + ${cfg.extraGSettingsOverrides} + EOF + + ${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/ + ''; + +in { + + options = { + + services.xserver.desktopManager.gnome3 = { + enable = mkOption { + default = false; + description = "Enable Gnome 3 desktop manager."; + }; + + sessionPath = mkOption { + default = []; + example = literalExample "[ pkgs.gnome3.gpaste ]"; + description = '' + Additional list of packages to be added to the session search path. + Useful for GNOME Shell extensions or GSettings-conditional autostart. + + Note that this should be a last resort; patching the package is preferred (see GPaste). + ''; + apply = list: list ++ [ pkgs.gnome3.gnome-shell pkgs.gnome3.gnome-shell-extensions ]; + }; + + extraGSettingsOverrides = mkOption { + default = ""; + type = types.lines; + description = "Additional gsettings overrides."; + }; + + extraGSettingsOverridePackages = mkOption { + default = []; + type = types.listOf types.path; + description = "List of packages for which gsettings are overridden."; + }; + + debug = mkEnableOption "gnome-session debug messages"; + }; + + environment.gnome3.excludePackages = mkOption { + default = []; + example = literalExample "[ pkgs.gnome3.totem ]"; + type = types.listOf types.package; + description = "Which packages gnome should exclude from the default environment"; + }; + + }; + + config = mkIf cfg.enable { + + # Enable helpful DBus services. + security.polkit.enable = true; + services.udisks2.enable = true; + services.accounts-daemon.enable = true; + services.geoclue2.enable = mkDefault true; + # GNOME should have its own geoclue agent + services.geoclue2.enableDemoAgent = false; + services.dleyna-renderer.enable = mkDefault true; + services.dleyna-server.enable = mkDefault true; + services.gnome3.at-spi2-core.enable = true; + services.gnome3.evolution-data-server.enable = true; + services.gnome3.gnome-disks.enable = mkDefault true; + services.gnome3.gnome-documents.enable = mkDefault true; + services.gnome3.gnome-keyring.enable = true; + services.gnome3.gnome-online-accounts.enable = mkDefault true; + services.gnome3.gnome-remote-desktop.enable = mkDefault true; + services.gnome3.gnome-terminal-server.enable = mkDefault true; + services.gnome3.gnome-user-share.enable = mkDefault true; + services.gnome3.gvfs.enable = true; + services.gnome3.rygel.enable = mkDefault true; + services.gnome3.seahorse.enable = mkDefault true; + services.gnome3.sushi.enable = mkDefault true; + services.gnome3.tracker.enable = mkDefault true; + services.gnome3.tracker-miners.enable = mkDefault true; + hardware.pulseaudio.enable = mkDefault true; + services.telepathy.enable = mkDefault true; + networking.networkmanager.enable = mkDefault true; + services.upower.enable = config.powerManagement.enable; + services.dbus.packages = mkIf config.services.printing.enable [ pkgs.system-config-printer ]; + services.colord.enable = mkDefault true; + services.packagekit.enable = mkDefault true; + hardware.bluetooth.enable = mkDefault true; + services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center + services.udev.packages = [ pkgs.gnome3.gnome-settings-daemon ]; + systemd.packages = [ pkgs.gnome3.vino ]; + services.flatpak.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + + # If gnome3 is installed, build vim for gtk3 too. + nixpkgs.config.vim.gui = "gtk3"; + + fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell-fonts ]; + + services.xserver.displayManager.extraSessionFilePackages = [ pkgs.gnome3.gnome-session ]; + + environment.extraInit = '' + ${concatMapStrings (p: '' + if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then + export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name} + fi + + if [ -d "${p}/lib/girepository-1.0" ]; then + export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib + fi + '') cfg.sessionPath} + ''; + + environment.variables.GNOME_SESSION_DEBUG = optionalString cfg.debug "1"; + + # Override default mimeapps + environment.variables.XDG_DATA_DIRS = [ "${mimeAppsList}/share" ]; + + # Override GSettings schemas + environment.variables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas"; + + # Let nautilus find extensions + # TODO: Create nautilus-with-extensions package + environment.variables.NAUTILUS_EXTENSION_DIR = "${config.system.path}/lib/nautilus/extensions-3.0"; + + services.xserver.updateDbusEnvironment = true; + + environment.variables.GIO_EXTRA_MODULES = [ "${lib.getLib pkgs.gnome3.dconf}/lib/gio/modules" + "${pkgs.gnome3.glib-networking.out}/lib/gio/modules" + "${pkgs.gnome3.gvfs}/lib/gio/modules" ]; + environment.systemPackages = pkgs.gnome3.corePackages ++ cfg.sessionPath + ++ (removePackagesByName pkgs.gnome3.optionalPackages config.environment.gnome3.excludePackages) ++ [ + pkgs.xdg-user-dirs # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/ + ]; + + # Use the correct gnome3 packageSet + networking.networkmanager.basePackages = + { inherit (pkgs) networkmanager modemmanager wpa_supplicant; + inherit (pkgs.gnome3) networkmanager-openvpn networkmanager-vpnc + networkmanager-openconnect networkmanager-fortisslvpn + networkmanager-iodine networkmanager-l2tp; }; + + # Needed for themes and backgrounds + environment.pathsToLink = [ "/share" ]; + + }; + + +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/kodi.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/kodi.nix new file mode 100644 index 000000000000..3ce49b9d2bf8 --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/kodi.nix @@ -0,0 +1,30 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.xserver.desktopManager.kodi; +in + +{ + options = { + services.xserver.desktopManager.kodi = { + enable = mkOption { + default = false; + description = "Enable the kodi multimedia center."; + }; + }; + }; + + config = mkIf cfg.enable { + services.xserver.desktopManager.session = [{ + name = "kodi"; + start = '' + ${pkgs.kodi}/bin/kodi --lircdev /var/run/lirc/lircd --standalone & + waitPID=$! + ''; + }]; + + environment.systemPackages = [ pkgs.kodi ]; + }; +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/lumina.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/lumina.nix new file mode 100644 index 000000000000..43fed2572b51 --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/lumina.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + xcfg = config.services.xserver; + cfg = xcfg.desktopManager.lumina; + +in + +{ + options = { + + services.xserver.desktopManager.lumina.enable = mkOption { + type = types.bool; + default = false; + description = "Enable the Lumina desktop manager"; + }; + + }; + + + config = mkIf (xcfg.enable && cfg.enable) { + + services.xserver.desktopManager.session = singleton { + name = "lumina"; + start = '' + exec ${pkgs.lumina}/bin/start-lumina-desktop + ''; + }; + + environment.systemPackages = [ + pkgs.fluxbox + pkgs.libsForQt5.kwindowsystem + pkgs.lumina + pkgs.numlockx + pkgs.qt5.qtsvg + pkgs.xscreensaver + ]; + + # Link some extra directories in /run/current-system/software/share + environment.pathsToLink = [ + "/share/lumina" + # FIXME: modules should link subdirs of `/share` rather than relying on this + "/share" + ]; + + }; +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/lxqt.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/lxqt.nix new file mode 100644 index 000000000000..896f70c86ebb --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/lxqt.nix @@ -0,0 +1,75 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + # Remove packages of ys from xs, based on their names + removePackagesByName = xs: ys: + let + pkgName = drv: (builtins.parseDrvName drv.name).name; + ysNames = map pkgName ys; + in + filter (x: !(builtins.elem (pkgName x) ysNames)) xs; + + xcfg = config.services.xserver; + cfg = xcfg.desktopManager.lxqt; + +in + +{ + options = { + + services.xserver.desktopManager.lxqt.enable = mkOption { + type = types.bool; + default = false; + description = "Enable the LXQt desktop manager"; + }; + + environment.lxqt.excludePackages = mkOption { + default = []; + example = literalExample "[ pkgs.lxqt.qterminal ]"; + type = types.listOf types.package; + description = "Which LXQt packages to exclude from the default environment"; + }; + + }; + + config = mkIf (xcfg.enable && cfg.enable) { + + services.xserver.desktopManager.session = singleton { + name = "lxqt"; + bgSupport = true; + start = '' + # Upstream installs default configuration files in + # $prefix/share/lxqt instead of $prefix/etc/xdg, (arguably) + # giving distributors freedom to ship custom default + # configuration files more easily. In order to let the session + # manager find them the share subdirectory is added to the + # XDG_CONFIG_DIRS environment variable. + # + # For an explanation see + # https://github.com/lxqt/lxqt/issues/1521#issuecomment-405097453 + # + export XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS''${XDG_CONFIG_DIRS:+:}${config.system.path}/share + + exec ${pkgs.lxqt.lxqt-session}/bin/startlxqt + ''; + }; + + environment.systemPackages = + pkgs.lxqt.preRequisitePackages ++ + pkgs.lxqt.corePackages ++ + (removePackagesByName + pkgs.lxqt.optionalPackages + config.environment.lxqt.excludePackages); + + # Link some extra directories in /run/current-system/software/share + environment.pathsToLink = [ "/share" ]; + + environment.variables.GIO_EXTRA_MODULES = [ "${pkgs.gvfs}/lib/gio/modules" ]; + + services.upower.enable = config.powerManagement.enable; + }; + +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/mate.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/mate.nix new file mode 100644 index 000000000000..db83aaf3c19f --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/mate.nix @@ -0,0 +1,116 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + # Remove packages of ys from xs, based on their names + removePackagesByName = xs: ys: + let + pkgName = drv: (builtins.parseDrvName drv.name).name; + ysNames = map pkgName ys; + in + filter (x: !(builtins.elem (pkgName x) ysNames)) xs; + + addToXDGDirs = p: '' + if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then + export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name} + fi + + if [ -d "${p}/lib/girepository-1.0" ]; then + export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0 + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib + fi + ''; + + xcfg = config.services.xserver; + cfg = xcfg.desktopManager.mate; + +in + +{ + options = { + + services.xserver.desktopManager.mate = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable the MATE desktop environment"; + }; + + debug = mkEnableOption "mate-session debug messages"; + }; + + environment.mate.excludePackages = mkOption { + default = []; + example = literalExample "[ pkgs.mate.mate-terminal pkgs.mate.pluma ]"; + type = types.listOf types.package; + description = "Which MATE packages to exclude from the default environment"; + }; + + }; + + config = mkIf (xcfg.enable && cfg.enable) { + + services.xserver.desktopManager.session = singleton { + name = "mate"; + bgSupport = true; + start = '' + # Set GTK_DATA_PREFIX so that GTK+ can find the themes + export GTK_DATA_PREFIX=${config.system.path} + + # Find theme engines + export GTK_PATH=${config.system.path}/lib/gtk-3.0:${config.system.path}/lib/gtk-2.0 + + export XDG_MENU_PREFIX=mate- + + # Find the mouse + export XCURSOR_PATH=~/.icons:${config.system.path}/share/icons + + # Let caja find extensions + export CAJA_EXTENSION_DIRS=$CAJA_EXTENSION_DIRS''${CAJA_EXTENSION_DIRS:+:}${config.system.path}/lib/caja/extensions-2.0 + + # Let caja extensions find gsettings schemas + ${concatMapStrings (p: '' + if [ -d "${p}/lib/caja/extensions-2.0" ]; then + ${addToXDGDirs p} + fi + '') + config.environment.systemPackages + } + + # Let mate-panel find applets + export MATE_PANEL_APPLETS_DIR=$MATE_PANEL_APPLETS_DIR''${MATE_PANEL_APPLETS_DIR:+:}${config.system.path}/share/mate-panel/applets + export MATE_PANEL_EXTRA_MODULES=$MATE_PANEL_EXTRA_MODULES''${MATE_PANEL_EXTRA_MODULES:+:}${config.system.path}/lib/mate-panel/applets + + # Add mate-control-center paths to some XDG variables because its schemas are needed by mate-settings-daemon, and mate-settings-daemon is a dependency for mate-control-center (that is, they are mutually recursive) + ${addToXDGDirs pkgs.mate.mate-control-center} + + # Update user dirs as described in http://freedesktop.org/wiki/Software/xdg-user-dirs/ + ${pkgs.xdg-user-dirs}/bin/xdg-user-dirs-update + + ${pkgs.mate.mate-session-manager}/bin/mate-session ${optionalString cfg.debug "--debug"} & + waitPID=$! + ''; + }; + + environment.systemPackages = + pkgs.mate.basePackages ++ + (removePackagesByName + pkgs.mate.extraPackages + config.environment.mate.excludePackages); + + services.dbus.packages = [ + pkgs.gnome3.dconf + pkgs.at-spi2-core + ]; + + services.gnome3.gnome-keyring.enable = true; + services.upower.enable = config.powerManagement.enable; + + security.pam.services."mate-screensaver".unixAuth = true; + + environment.pathsToLink = [ "/share" ]; + }; + +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/maxx.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/maxx.nix new file mode 100644 index 000000000000..d7bd2fc5eb0c --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/maxx.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + xcfg = config.services.xserver; + cfg = xcfg.desktopManager.maxx; +in { + options.services.xserver.desktopManager.maxx = { + enable = mkEnableOption "MaXX desktop environment"; + }; + + config = mkIf (xcfg.enable && cfg.enable) { + environment.systemPackages = [ pkgs.maxx ]; + + services.xserver.desktopManager.session = [ + { name = "MaXX"; + start = '' + exec ${pkgs.maxx}/opt/MaXX/etc/skel/Xsession.dt + ''; + }]; + }; + + meta.maintainers = [ maintainers.gnidorah ]; +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/none.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/none.nix new file mode 100644 index 000000000000..af7a376ae029 --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/none.nix @@ -0,0 +1,7 @@ +{ + services.xserver.desktopManager.session = + [ { name = "none"; + start = ""; + } + ]; +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix new file mode 100644 index 000000000000..704cc78c1528 --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix @@ -0,0 +1,231 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + xcfg = config.services.xserver; + cfg = xcfg.desktopManager.plasma5; + + inherit (pkgs) kdeApplications plasma5 libsForQt5 qt5; + +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 a + default backend for Phonon. + ''; + }; + + }; + + }; + + + config = mkMerge [ + (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" + ''} + + if [ -f "$HOME/.config/kdeglobals" ] + then + # Remove extraneous font style names. + # See also: https://phabricator.kde.org/D9070 + ${getBin pkgs.gnused}/bin/sed -i "$HOME/.config/kdeglobals" \ + -e '/^fixed=/ s/,Regular$//' \ + -e '/^font=/ s/,Regular$//' \ + -e '/^menuFont=/ s/,Regular$//' \ + -e '/^smallestReadableFont=/ s/,Regular$//' \ + -e '/^toolBarFont=/ s/,Regular$//' + fi + + exec "${getBin plasma5.plasma-workspace}/bin/startkde" + ''; + }; + + security.wrappers = { + kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/lib/libexec/kcheckpass"; + "start_kdeinit".source = "${lib.getBin pkgs.kinit}/lib/libexec/kf5/start_kdeinit"; + kwin_wayland = { + source = "${lib.getBin plasma5.kwin}/bin/kwin_wayland"; + capabilities = "cap_sys_nice+ep"; + }; + }; + + environment.systemPackages = with pkgs; with qt5; with libsForQt5; with plasma5; with kdeApplications; + [ + frameworkintegration + kactivities + kauth + kcmutils + kconfig + kconfigwidgets + kcoreaddons + kdoctools + 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 + dolphin-plugins + ffmpegthumbs + kdegraphics-thumbnailers + khelpcenter + kio-extras + konsole + oxygen + print-manager + + breeze-icons + pkgs.hicolor-icon-theme + + kde-gtk-config breeze-gtk + + qtvirtualkeyboard + + libsForQt56.phonon-backend-gstreamer + libsForQt5.phonon-backend-gstreamer + ] + + ++ lib.optionals cfg.enableQt4Support [ 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 ]; + + environment.pathsToLink = [ + # FIXME: modules should link subdirs of `/share` rather than relying on this + "/share" + ]; + + environment.etc = singleton { + source = xcfg.xkbDir; + target = "X11/xkb"; + }; + + # Enable GTK applications to load SVG icons + services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; + + fonts.fonts = with pkgs; [ noto-fonts hack-font ]; + fonts.fontconfig.defaultFonts = { + monospace = [ "Hack" "Noto Mono" ]; + sansSerif = [ "Noto Sans" ]; + serif = [ "Noto Serif" ]; + }; + + programs.ssh.askPassword = mkDefault "${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 = mkDefault "breeze"; + }; + + 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; + + # Update the start menu for each user that is currently logged in + system.userActivationScripts.plasmaSetup = "${pkgs.libsForQt5.kservice}/bin/kbuildsycoca5"; + }) + ]; + +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce.nix new file mode 100644 index 000000000000..dabf09418da7 --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/xfce.nix @@ -0,0 +1,132 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.xserver.desktopManager.xfce; +in + +{ + options = { + services.xserver.desktopManager.xfce = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable the Xfce desktop environment."; + }; + + thunarPlugins = mkOption { + default = []; + type = types.listOf types.package; + example = literalExample "[ pkgs.xfce.thunar-archive-plugin ]"; + description = '' + A list of plugin that should be installed with Thunar. + ''; + }; + + noDesktop = mkOption { + type = types.bool; + default = false; + description = "Don't install XFCE desktop components (xfdesktop, panel and notification daemon)."; + }; + + extraSessionCommands = mkOption { + default = ""; + type = types.lines; + description = '' + Shell commands executed just before XFCE is started. + ''; + }; + + enableXfwm = mkOption { + type = types.bool; + default = true; + description = "Enable the XFWM (default) window manager."; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs.xfce // pkgs; [ + # Get GTK+ themes and gtk-update-icon-cache + gtk2.out + + # Supplies some abstract icons such as: + # utilities-terminal, accessories-text-editor + gnome3.defaultIconTheme + + hicolor-icon-theme + tango-icon-theme + xfce4-icon-theme + + # Needed by Xfce's xinitrc script + # TODO: replace with command -v + which + + exo + garcon + gtk-xfce-engine + gvfs + libxfce4ui + tumbler + xfconf + + mousepad + ristretto + xfce4-appfinder + xfce4-screenshooter + xfce4-session + xfce4-settings + xfce4-terminal + + (thunar.override { thunarPlugins = cfg.thunarPlugins; }) + thunar-volman # TODO: drop + ] ++ (if config.hardware.pulseaudio.enable + then [ xfce4-mixer-pulse xfce4-volumed-pulse ] + else [ xfce4-mixer xfce4-volumed ]) + # TODO: NetworkManager doesn't belong here + ++ optionals config.networking.networkmanager.enable [ networkmanagerapplet ] + ++ optionals config.powerManagement.enable [ xfce4-power-manager ] + ++ optionals cfg.enableXfwm [ xfwm4 ] + ++ optionals (!cfg.noDesktop) [ + xfce4-panel + xfce4-notifyd + xfdesktop + ]; + + environment.pathsToLink = [ + "/share/xfce4" + "/share/themes" + "/share/gtksourceview-2.0" + ]; + + environment.variables = { + GIO_EXTRA_MODULES = [ "${pkgs.xfce.gvfs}/lib/gio/modules" ]; + }; + + services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; + + services.xserver.desktopManager.session = [{ + name = "xfce"; + bgSupport = true; + start = '' + ${cfg.extraSessionCommands} + + # Set GTK_PATH so that GTK+ can find the theme engines. + export GTK_PATH="${config.system.path}/lib/gtk-2.0:${config.system.path}/lib/gtk-3.0" + + # Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes. + export GTK_DATA_PREFIX=${config.system.path} + + ${pkgs.runtimeShell} ${pkgs.xfce.xinitrc} & + waitPID=$! + ''; + }]; + + services.xserver.updateDbusEnvironment = true; + + # Enable helpful DBus services. + services.udisks2.enable = true; + services.upower.enable = config.powerManagement.enable; + }; +} diff --git a/nixpkgs/nixos/modules/services/x11/desktop-managers/xterm.nix b/nixpkgs/nixos/modules/services/x11/desktop-managers/xterm.nix new file mode 100644 index 000000000000..6ff1ef0e4c9a --- /dev/null +++ b/nixpkgs/nixos/modules/services/x11/desktop-managers/xterm.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.xserver.desktopManager.xterm; + +in + +{ + options = { + + services.xserver.desktopManager.xterm.enable = mkOption { + type = types.bool; + default = true; + description = "Enable a xterm terminal as a desktop manager."; + }; + + }; + + config = mkIf (config.services.xserver.enable && cfg.enable) { + + services.xserver.desktopManager.session = singleton + { name = "xterm"; + start = '' + ${pkgs.xterm}/bin/xterm -ls & + waitPID=$! + ''; + }; + + environment.systemPackages = [ pkgs.xterm ]; + + }; + +} |