GNOME: Difference between revisions

adwaita-icon-theme has moved to top-level
Add mention about missing gnome-themes-extra and gtk-3.0 application not respecting dark theme
(7 intermediate revisions by 5 users not shown)
Line 24: Line 24:
{
{
   environment.gnome.excludePackages = with pkgs; [
   environment.gnome.excludePackages = with pkgs; [
     gnome-tour
    orca
    evince
    # file-roller
    geary
    gnome-disk-utility
    # seahorse
    # sushi
    # sysprof
    #
    # gnome-shell-extensions
    #
    # adwaita-icon-theme
    # nixos-background-info
    gnome-backgrounds
    # gnome-bluetooth
    # gnome-color-manager
    # gnome-control-center
    # gnome-shell-extensions
     gnome-tour # GNOME Shell detects the .desktop file on first log-in.
    gnome-user-docs
    # glib # for gsettings program
    # gnome-menus
    # gtk3.out # for gtk-launch program
    # xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
    # xdg-user-dirs-gtk # Used to create the default bookmarks
    #
    baobab
    epiphany
    gnome-text-editor
    gnome-calculator
    gnome-calendar
    gnome-characters
    # gnome-clocks
    gnome-console
    gnome-contacts
    gnome-font-viewer
    gnome-logs
    gnome-maps
    gnome-music
    # gnome-system-monitor
    gnome-weather
    # loupe
    # nautilus
     gnome-connections
     gnome-connections
     epiphany # web browser
     simple-scan
     gnome.geary # email reader. Up to 24.05. Starting from 24.11 the package name is just geary.
     snapshot
     evince # document viewer
    totem
    yelp
     gnome-software
   ];
   ];
}
}
Line 93: Line 137:
{{file|~/.config/home-manager/home.nix|nix|<nowiki>
{{file|~/.config/home-manager/home.nix|nix|<nowiki>
{
{
   dconf.settings = {
   dconf = {
     enable = true;
     enable = true;


     # You need quotes to escape '/'
     settings = {
    "org/gnome/desktop/interface" = {
      # You need quotes to escape '/'
      clock-show-weekday = true;
      "org/gnome/desktop/interface" = {
        clock-show-weekday = true;
      };
     };
     };
   };
   };
Line 164: Line 210:
{
{
   environment.systemPackages = [ pkgs.adwaita-icon-theme ];
   environment.systemPackages = [ pkgs.adwaita-icon-theme ];
}
</syntaxhighlight>If you're using the default theme, GTK-3 applications may not respect the dark theme if they can't find the Adwaita. To fix it, make sure you have the <code>gnome-themes-extra</code> package installed:<syntaxhighlight lang="nix">
{
  environment.systemPackages = [ pkgs.gnome-themes-extra ];
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 179: Line 229:
And ensure gnome-settings-daemon udev rules are enabled:
And ensure gnome-settings-daemon udev rules are enabled:


<syntaxHighlight lang="nix">
<syntaxhighlight lang="nix">
{
{
   services.udev.packages = [ pkgs.gnome.gnome-settings-daemon ];
   services.udev.packages = [ pkgs.gnome-settings-daemon ];
}
}
</syntaxHighlight>
</syntaxhighlight>


=== To run old applications ===
=== To run old applications ===
Line 211: Line 261:
If you wish to try this patch for yourself, add the following to your NixOS configuration:
If you wish to try this patch for yourself, add the following to your NixOS configuration:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  nixpkgs.overlays = [
    # GNOME 46: triple-buffering-v4-46
    (final: prev: {
      mutter = prev.mutter.overrideAttrs (old: {
        src = pkgs.fetchFromGitLab  {
          domain = "gitlab.gnome.org";
          owner = "vanvugt";
          repo = "mutter";
          rev = "triple-buffering-v4-46";
          hash = "sha256-C2VfW3ThPEZ37YkX7ejlyumLnWa9oij333d5c4yfZxc=";
        };
      });
    })
  ];
}
</nowiki>}}
For GNOME 47, use the following configuration instead:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
  nixpkgs.overlays = [
    # GNOME 47: triple-buffering-v4-47
    (final: prev: {
      mutter = prev.mutter.overrideAttrs (oldAttrs: {
        # GNOME dynamic triple buffering (huge performance improvement)
        # See https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1441
        # Also https://gitlab.gnome.org/vanvugt/mutter/-/tree/triple-buffering-v4-47
        src = final.fetchFromGitLab {
          domain = "gitlab.gnome.org";
          owner = "vanvugt";
          repo = "mutter";
          rev = "triple-buffering-v4-47";
          hash = "sha256-Jlhzt2Cc44epkBcz3PA6I5aTnVEqMsHBOE8aEmvANWw=";
        };
        # GNOME 47 requires the gvdb subproject which is not included in the triple-buffering branch
        # This copies the necessary gvdb files from the official GNOME repository
        preConfigure = let
          gvdb = final.fetchFromGitLab {
            domain = "gitlab.gnome.org";
            owner = "GNOME";
            repo = "gvdb";
            rev = "2b42fc75f09dbe1cd1057580b5782b08f2dcb400";
            hash = "sha256-CIdEwRbtxWCwgTb5HYHrixXi+G+qeE1APRaUeka3NWk=";
          };
        in ''
          cp -a "${gvdb}" ./subprojects/gvdb
        '';
      });
    })
  ];
}
</nowiki>}}
==== Flakes approach ====
If you're using flakes, you can add the repositories as inputs.
It will save you the burden of updating the dependencies manually, but at a cost of laziness: they will always be fetched regardless of whether they're actually needed to build the current artifact/configuration. This may not be always desirable.
{{file|flake.nix (inputs section)|nix|<nowiki>
{
  # In inputs:
  mutter-triple-buffering-src = {
    url = "gitlab:vanvugt/mutter?ref=triple-buffering-v4-47&host=gitlab.gnome.org";
    flake = false;
  };
  gvdb-src = {
    url = "gitlab:GNOME/gvdb?ref=main&host=gitlab.gnome.org";
    flake = false;
  };
}
</nowiki>}}
Then, in your overlay section:
{{file|flake.nix (overlay section)|nix|<nowiki>
{
  # In your overlay:
  mutter = super.mutter.overrideAttrs (old: {
    src = inputs.mutter-triple-buffering-src;
    preConfigure = ''
      cp -a "${inputs.gvdb-src}" ./subprojects/gvdb
    '';
  });
}
</nowiki>}}
{{Note|For GNOME 47, the gvdb dependency must be manually added to the subprojects directory during build. The preConfigure hook handles this by fetching the required repository and placing it in the correct location.}}
Prior to [https://github.com/NixOS/nixpkgs/commit/7f387d6bf915b8fd7d7131edd3e5107f4a98cc9d commit 7f387d6b] (~01.09.2024 for master) <code>mutter</code> was located in <code>gnome</code> scope, so <code>overrideScope</code> was required to achieve the same result:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{
{
Line 231: Line 376:
}
}
</nowiki>}}
</nowiki>}}


You might need to disable aliases to make it work:
You might need to disable aliases to make it work: