Gnome 3.38 on latest release

Hey there! I’m looking to use Gnome 3.38 on the latest nixpkgs release. Any tips on how I can do that?

I’m using flakes and I’ve tried using overlays but haven’t had much luck.

Here’s what I’ve tried so far. Any help would be massively appreciated!

nixosConfigurations.nixos = inputs.nixpkgs-unstable.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = { inherit inputs; pkgs-stable = inputs.nixpkgs.legacyPackages.x86_64-linux; };
      # ...
# Overlay
(final: prev: {
  gnome = pkgs-stable.gnome3;
  desktops.gnome = ({config, pkgs, lib }: pkgs-stable.desktops.gnome3 { inherit config lib; pkgs = pkgs-stable; });
})

FYI - the reason for wanting this version of Gnome is for compatibility with the pop-shell extension.

1 Like

I’m having the same question for the same reason.

You have not shown what the issue is or how you are using the overlay.

Especially, it is not clear to me what you are trying to achieve by the desktops.gnome thing. There is no desktops attribute in Nixpkgs.


Either way, overlays will not be enough as some NixOS modules changed so you will need to blacklist them and use the ones from old Nixpkgs. Looking at the changes, doing it for the GDM module should be sufficient (do not forget to add the old attributes used by the module to the overlay).


You also might want to replace only some core packages gnome-shell, mutter, gnome-session and gdm to be able to use e.g. fresh Geary:

(final: prev: {
  gnome = prev.gnome.overrideScope' (finalGnome: prevGnome: {
    gnome-shell = pkgs-stable.gnome3.gnome-shell;
    …
  });
})

Or even better, use the old expression with packages mostly from new Nixpkgs so that you minimize the risk of depending on potentially unsecure libraries:

(final: prev: {
  gnome = prev.gnome.overrideScope' (finalGnome: prevGnome: {
    gnome-shell = finalGnome.callPackage "${pkgs-stable}/pkgs/desktops/gnome-3/core/gnome-shell" { gnome3 = finalGnome; };
    …
  });
})

But yeah, none of this is tested and it will likely be a pretty bumpy ride.

Yeah I found out that with each new release of a package, for most cases, it’s a breaking change (i.e. previous version is removed).

So it seems like versioning on a package-by-package basis (rather than a repo-revision basis) isn’t going to be an option :disappointed:.

I would not rule it out completely. Just like on traditional distro, you can install older versions of packages at your own risk. And you need to make sure all software is compatible.

And the benefit of NixOS is that you can do all of that declaratively, trivially build a VM image to test it or just deploy it and rollback if it does not work.

I would expect the following untested NixOS module you can just incorporate/import into your system configuration will get you pretty far.

{ pkgs, ... }:
let
  # Revision from https://4shells.com/nixdb/pkg/gnome3.gnome-shell/3.38.2
  pkgs-stable = import (pkgs.fetchzip {
    url = "https://github.com/nixos/nixpkgs/archive/7138a338b58713e0dea22ddab6a6785abec7376a.zip";
    # Please update this hash with the one nix says on the first build attempt
    sha256 = "0000000000000000000000000000000000000000000000000000000000000000";
  }) { };
in
{
  disabledModules = [
    "services/x11/display-managers/gdm.nix"
  ];
  imports = [
    "${pkgs-stable}/nixos/modules/services/x11/display-managers/gdm.nix"
  ];

  nixpkgs.overlays = [
    (final: prev: {
      gnome = prev.gnome.overrideScope' (finalGnome: prevGnome: {
        gnome-shell = finalGnome.callPackage "${pkgs-stable}/pkgs/desktops/gnome-3/core/gnome-shell" { gnome3 = finalGnome; };
        gnome-session = finalGnome.callPackage "${pkgs-stable}/pkgs/desktops/gnome-3/core/gnome-session" { gnome3 = finalGnome; };
        gdm = finalGnome.callPackage "${pkgs-stable}/pkgs/desktops/gnome-3/core/gdm" { gnome3 = finalGnome; };
        mutter = finalGnome.callPackage "${pkgs-stable}/pkgs/desktops/gnome-3/core/mutter" { gnome3 = finalGnome; };
      });
      # Alias for the gdm module.
      gnome3 = final.gnome;
    })
  ];
}