You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pantheon.nix 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. { config, lib, pkgs, ... }:
  2. with lib;
  3. let
  4. cfg = config.services.xserver.desktopManager.pantheon;
  5. nixos-gsettings-desktop-schemas = pkgs.pantheon.elementary-gsettings-schemas.override {
  6. extraGSettingsOverridePackages = cfg.extraGSettingsOverridePackages;
  7. extraGSettingsOverrides = cfg.extraGSettingsOverrides;
  8. };
  9. in
  10. {
  11. meta.maintainers = pkgs.pantheon.maintainers;
  12. options = {
  13. services.xserver.desktopManager.pantheon = {
  14. enable = mkOption {
  15. type = types.bool;
  16. default = false;
  17. description = "Enable the pantheon desktop manager";
  18. };
  19. sessionPath = mkOption {
  20. default = [];
  21. example = literalExample "[ pkgs.gnome3.gpaste ]";
  22. description = ''
  23. Additional list of packages to be added to the session search path.
  24. Useful for GSettings-conditional autostart.
  25. Note that this should be a last resort; patching the package is preferred (see GPaste).
  26. '';
  27. apply = list: list ++
  28. [
  29. pkgs.pantheon.pantheon-agent-geoclue2
  30. ];
  31. };
  32. extraGSettingsOverrides = mkOption {
  33. default = "";
  34. type = types.lines;
  35. description = "Additional gsettings overrides.";
  36. };
  37. extraGSettingsOverridePackages = mkOption {
  38. default = [];
  39. type = types.listOf types.path;
  40. description = "List of packages for which gsettings are overridden.";
  41. };
  42. debug = mkEnableOption "gnome-session debug messages";
  43. };
  44. environment.pantheon.excludePackages = mkOption {
  45. default = [];
  46. example = literalExample "[ pkgs.pantheon.elementary-camera ]";
  47. type = types.listOf types.package;
  48. description = "Which packages pantheon should exclude from the default environment";
  49. };
  50. };
  51. config = mkIf cfg.enable {
  52. services.xserver.displayManager.extraSessionFilePackages = [ pkgs.pantheon.elementary-session-settings ];
  53. # Ensure lightdm is used when Pantheon is enabled
  54. # Without it screen locking will be nonfunctional because of the use of lightlocker
  55. warnings = optional (config.services.xserver.displayManager.lightdm.enable != true)
  56. ''
  57. Using Pantheon without LightDM as a displayManager will break screenlocking from the UI.
  58. '';
  59. services.xserver.displayManager.lightdm.greeters.pantheon.enable = mkDefault true;
  60. # If not set manually Pantheon session cannot be started
  61. # Known issue of https://github.com/NixOS/nixpkgs/pull/43992
  62. services.xserver.desktopManager.default = mkForce "pantheon";
  63. services.xserver.displayManager.sessionCommands = ''
  64. if test "$XDG_CURRENT_DESKTOP" = "Pantheon"; then
  65. ${concatMapStrings (p: ''
  66. if [ -d "${p}/share/gsettings-schemas/${p.name}" ]; then
  67. export XDG_DATA_DIRS=$XDG_DATA_DIRS''${XDG_DATA_DIRS:+:}${p}/share/gsettings-schemas/${p.name}
  68. fi
  69. if [ -d "${p}/lib/girepository-1.0" ]; then
  70. export GI_TYPELIB_PATH=$GI_TYPELIB_PATH''${GI_TYPELIB_PATH:+:}${p}/lib/girepository-1.0
  71. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${p}/lib
  72. fi
  73. '') cfg.sessionPath}
  74. fi
  75. '';
  76. hardware.bluetooth.enable = mkDefault true;
  77. hardware.pulseaudio.enable = mkDefault true;
  78. security.polkit.enable = true;
  79. services.accounts-daemon.enable = true;
  80. services.bamf.enable = true;
  81. services.colord.enable = mkDefault true;
  82. services.pantheon.files.enable = mkDefault true;
  83. services.tumbler.enable = mkDefault true;
  84. services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));
  85. services.dbus.packages = with pkgs.pantheon; [
  86. switchboard-plug-power
  87. elementary-default-settings
  88. ];
  89. services.pantheon.contractor.enable = mkDefault true;
  90. services.gnome3.at-spi2-core.enable = true;
  91. services.gnome3.evolution-data-server.enable = true;
  92. services.gnome3.glib-networking.enable = true;
  93. # TODO: gnome-keyring's xdg autostarts will still be in the environment (from elementary-session-settings) if disabled forcefully
  94. services.gnome3.gnome-keyring.enable = true;
  95. services.gnome3.gnome-settings-daemon.enable = true;
  96. services.udev.packages = [ pkgs.pantheon.elementary-settings-daemon ];
  97. services.gvfs.enable = true;
  98. services.gnome3.rygel.enable = mkDefault true;
  99. services.gsignond.enable = mkDefault true;
  100. services.gsignond.plugins = with pkgs.gsignondPlugins; [ lastfm mail oauth ];
  101. services.udisks2.enable = true;
  102. services.upower.enable = config.powerManagement.enable;
  103. services.xserver.libinput.enable = mkDefault true;
  104. services.xserver.updateDbusEnvironment = true;
  105. services.zeitgeist.enable = mkDefault true;
  106. services.geoclue2.enable = mkDefault true;
  107. # pantheon has pantheon-agent-geoclue2
  108. services.geoclue2.enableDemoAgent = false;
  109. services.geoclue2.appConfig."io.elementary.desktop.agent-geoclue2" = {
  110. isAllowed = true;
  111. isSystem = true;
  112. };
  113. programs.dconf.enable = true;
  114. programs.evince.enable = mkDefault true;
  115. programs.file-roller.enable = mkDefault true;
  116. # Otherwise you can't store NetworkManager Secrets with
  117. # "Store the password only for this user"
  118. programs.nm-applet.enable = true;
  119. # Shell integration for VTE terminals
  120. programs.bash.vteIntegration = mkDefault true;
  121. programs.zsh.vteIntegration = mkDefault true;
  122. # Harmonize Qt5 applications under Pantheon
  123. qt5.enable = true;
  124. qt5.platformTheme = "gnome";
  125. qt5.style = "adwaita";
  126. networking.networkmanager.enable = mkDefault true;
  127. # Override GSettings schemas
  128. environment.sessionVariables.NIX_GSETTINGS_OVERRIDES_DIR = "${nixos-gsettings-desktop-schemas}/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas";
  129. environment.sessionVariables.GNOME_SESSION_DEBUG = optionalString cfg.debug "1";
  130. # Settings from elementary-default-settings
  131. environment.sessionVariables.GTK_CSD = "1";
  132. environment.sessionVariables.GTK_MODULES = "pantheon-filechooser-module";
  133. environment.etc."gtk-3.0/settings.ini".source = "${pkgs.pantheon.elementary-default-settings}/etc/gtk-3.0/settings.ini";
  134. environment.pathsToLink = [
  135. # FIXME: modules should link subdirs of `/share` rather than relying on this
  136. "/share"
  137. ];
  138. environment.systemPackages =
  139. pkgs.pantheon.artwork ++ pkgs.pantheon.desktop ++ pkgs.pantheon.services ++ cfg.sessionPath
  140. ++ (with pkgs; gnome3.removePackagesByName
  141. ([
  142. gnome3.geary
  143. gnome3.epiphany
  144. gnome3.gnome-font-viewer
  145. ] ++ pantheon.apps) config.environment.pantheon.excludePackages)
  146. ++ (with pkgs;
  147. [
  148. adwaita-qt
  149. desktop-file-utils
  150. glib
  151. glib-networking
  152. gnome-menus
  153. gnome3.adwaita-icon-theme
  154. gtk3.out
  155. hicolor-icon-theme
  156. lightlocker
  157. onboard
  158. plank
  159. qgnomeplatform
  160. shared-mime-info
  161. sound-theme-freedesktop
  162. xdg-user-dirs
  163. ]);
  164. fonts.fonts = with pkgs; [
  165. open-sans
  166. roboto-mono
  167. pantheon.elementary-redacted-script # needed by screenshot-tool
  168. ];
  169. fonts.fontconfig.defaultFonts = {
  170. monospace = [ "Roboto Mono" ];
  171. sansSerif = [ "Open Sans" ];
  172. };
  173. };
  174. }