Howto: Disable most gnome default applications (and what they are)

Installing gnome also installs a lot of default applications, sometimes you may want to use different applications instead in which case the gnome native applications can get a little annoying.
Luckily there is a config option to disable them.

Below is an expression that disables them all with comments describing their function:

  environment.gnome.excludePackages = with pkgs.gnome; [
    baobab      # disk usage analyzer
    cheese      # photo booth
    eog         # image viewer
    epiphany    # web browser
    gedit       # text editor
    simple-scan # document scanner
    totem       # video player
    yelp        # help viewer
    evince      # document viewer
    file-roller # archive manager
    geary       # email client
    seahorse    # password manager

    # these should be self explanatory
    gnome-calculator gnome-calendar gnome-characters gnome-clocks gnome-contacts
    gnome-font-viewer gnome-logs gnome-maps gnome-music gnome-photos gnome-screenshot
    gnome-system-monitor gnome-weather gnome-disk-utility pkgs.gnome-connections
  ];

Finally there also is pkgs.gnome.gnome-terminal, but disabling that might lock you out of your system.

18 Likes

Thank you for sharing @busti ! I have wanted to do this for a while but never looked into it.

1 Like

Adding on to that, services.gnome.core-utilities.enable = false; disables them all at once.

6 Likes

been searching for this for about 3 days, I just couldnā€™t find the packages names in search.nixos.org

Yeah, found that in the documentation, however I wanted some of those applications, but to remove only the ones I didnā€™t want was hard, because I couldnā€™t find their names anywhere I searched!

@Thiago-Assis-T @busti this may be worthwhile to add to the NixOS manual, where it belongs. Ping me if you need any help with making a pull request. Or at least you could open an issue and link to this thread.

We already have a that: NixOS 23.11 manual | Nix & NixOS

The issue is that apps predating GNOMEā€™s current naming policy often have an internal name with no obvious connection to the application name. For example, an app called Archive Manager everywhere in its user interface is actually a File Roller originally, and the attribute name reflects that.

To find out the attribute name, you first need to discover the internal name. The following options immediately come to my mind:

  • Click the website link in the About dialogue
  • Press Alt-F2, type lg and press Enter to open GNOME Shellā€™s Looking Glass interface, then find it based on the icon in the Windows tab.
  • Run xprop program on the terminal and click the Archive Manager window. Then notice the value of the _GTK_APPLICATION_ID property. (Probably will not work on Wayland.)
  • Press Control-Shift-I to open GTK inspector, view the application ID in the General tab.

But if a person is aware of those methods, they are probably familiar enough with GNOME to already know the app name.

Then you can search it on NixOS Search. to discover the attribute name.

Also relevant: Initiative: matching user-facing and internal names of GNOME projects - Desktop - GNOME Discourse

2 Likes

@jtojnar I indeed thought about making that list or your methods explicit in the manual, or some other type of convenience such as adding attribute name aliases to help with that sort of discoverability. The manual currently only shows there is a mechanism, not how to make use of it.

1 Like

indeed, this worked like a charm, I didnā€™t know about this beforeā€¦
even though the names were on the thread, it is good to learn about this, because I wasnā€™t able to find the internal name of the apps.
Thank you very much!

This is awesome, thanks!

FYI: If anyone else runs into an ā€œundefined variableā€ error on ā€˜gnome-photosā€™ when building the nix config after making this change, I was able to resolve that by changing it to ā€˜pkgs.gnome-photosā€™

Thereā€™s also the ā€˜pkgs.gnome-text-editorā€™ and ā€˜pkgs.gnome-tourā€™ apps that people might consider removing.

3 Likes

These are the GNOME core apps but there are some other programs installed when GNOME is enabled.

Some services enabled by core-os-services can be disabled:

hardware.bluetooth.enable = mkDefault true;
hardware.pulseaudio.enable = mkDefault true;
programs.dconf.enable = true;
security.polkit.enable = true;
services.accounts-daemon.enable = true;
services.dleyna-renderer.enable = mkDefault true;
services.dleyna-server.enable = mkDefault true;
services.power-profiles-daemon.enable = mkDefault true;
services.gnome.at-spi2-core.enable = true;
services.gnome.evolution-data-server.enable = true;
services.gnome.gnome-keyring.enable = true;
services.gnome.gnome-online-accounts.enable = mkDefault true;
services.gnome.gnome-online-miners.enable = true;
services.gnome.tracker-miners.enable = mkDefault true;
services.gnome.tracker.enable = mkDefault true;
services.hardware.bolt.enable = mkDefault true;
services.udisks2.enable = true;
services.upower.enable = config.powerManagement.enable;
services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
networking.networkmanager.enable = mkDefault true;
services.colord.enable = mkDefault true;
services.gnome.glib-networking.enable = true;
services.gnome.gnome-browser-connector.enable = mkDefault true;
services.gnome.gnome-initial-setup.enable = mkDefault true;
services.gnome.gnome-remote-desktop.enable = mkDefault true;
services.gnome.gnome-settings-daemon.enable = true;
services.gnome.gnome-user-share.enable = mkDefault true;
services.gnome.rygel.enable = mkDefault true;
services.gvfs.enable = true;
services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));
services.avahi.enable = mkDefault true;
services.geoclue2.enable = mkDefault true;

Some other apps can be excluded:

with pkgs.gnome; [
  adwaita-icon-theme
  # nixos-background-info This can't be excluded since it's defined locally. So even if we removed all GNOME backgrounds it seems we have to keep the NixOS one.
  gnome-backgrounds
  gnome-bluetooth
  gnome-color-manager
  gnome-control-center
  gnome-shell-extensions
  gnome-themes-extra
  pkgs.gnome-tour # GNOME Shell detects the .desktop file on first log-in.
  pkgs.gnome-user-docs
  pkgs.orca
  pkgs.glib # for gsettings program
  pkgs.gnome-menus
  pkgs.gtk3.out # for gtk-launch program
  pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
  baobab
  epiphany
  pkgs.gnome-text-editor
  gnome-calculator
  gnome-calendar
  gnome-characters
  gnome-clocks
  pkgs.gnome-console
  gnome-contacts
  gnome-font-viewer
  gnome-logs
  gnome-maps
  gnome-music
  gnome-system-monitor
  gnome-weather
  pkgs.loupe
  nautilus
  pkgs.gnome-connections
  simple-scan
  pkgs.snapshot
  totem
  yelp
];

By the way, I donā€™t know why pkgs.gnome.gnome-shell-extensions is added twice in https://github.com/NixOS/nixpkgs/blob/a8f393e6c1c80dc979e9209eea9eb4b75833df70/nixos/modules/services/x11/desktop-managers/gnome.nix.

After disabling many unused apps looks like GNOME still works well, except that the control center has some issues. After disabling gnome-online-accounts, the corresponding panel has no icons anymore. And the sharing panel freezes the program. It seems I can disable the panel by removing the corresponding desktop files but I donā€™t know how to do that without patching and rebuild the control center.

1 Like

I would really advise against disabling core services unless you want to deal with a partly broken system. Even though system will probably run if you disable some of them, it is untested configuration and some components may spam logs with errors, include unusable UI or even crash.

The sessionPath is a hack needed for some of the extensions to load properly with NixOS filesystem hierarchy.

Packages are immutable so you will either need to patch and rebuild, or create a new derivation copying the files from the old one and replacing all the references to old derivationā€™s outputs with the new oneā€™s.

If Iā€™m on other distributions I wonā€™t bother but Iā€™m on NixOS so I donā€™t worry. :rofl:

I expected that I can somehow prevent the files linked to current-system but it seems impossible.

current-system is just another immutable package that symlinks stuff in environment.systemPackages (built with buildEnv).

You could inject extra code to environment.extraSetup NixOS option to remove the desktop files from the symlink tree. But that might require manual reification of symlinks if you are unlucky and the files you want to remove are inside a symlink to a directory in another package. And it will not help you if a package looks directly to g-c-c Nix store path, you would need to update the references in the package. At that point, you might want to use system.replaceRuntimeDependencies hack but that is a bit tricky.

Alternately, you could install a package with higher priority to environment.systemPackages, that would contain a dummy version of the files you want to remove. But again, that will not work if a package looks directly to g-c-c Nix store path.

Anyway, this is getting off-topic so please open a new thread if you want discuss this avenue further.

I was able to use this discussion and GNOME - NixOS Wiki to get mine working.

For some reason photos and tour had some issues and threw errors. I had to add the pkgs.gnome to them and then it was okay.

  # Exclude Core Apps From Being Installed.
  environment.gnome.excludePackages = with pkgs.gnome; [
    epiphany     # web browser
    gedit     # text editor
    totem     # video player
    yelp     # help viewer
    geary     # email client
    gnome-calendar     # calendar
    gnome-contacts     # contacts
    gnome-maps      # maps
    gnome-music     # music
    pkgs.gnome-photos     # photos
    pkgs.gnome-tour     # tour app
    evince     # document viewer
  ];