Need help with an overlay for Pantheon DE

:wave: hey fellow Nix aficionados, I need your aid!

I am in the process of switching my DE’s and decided to give Pantheon a spin.
By default, Pantheon comes with switchboard plugs and wingpanel indicators for network and Bluetooth, both of which I don’t actually need – I use a hardwired desktop machine with static address and no Bluetooth module, so I would love to drop dependencies on NetworkManager and Bluez stack.

Reading up the Docs and Wiki, they both mention that I can simply use override on the wingpanel-with-indicators to disable default indicators and configure the ones I need. So I put together an overlay to try and achieve this, which is looking something like this:

(
  self: super:
  let
    pantheon = super.pantheon;
    wingpanel = pantheon.wingpanel-with-indicators;

    wingpanelIndicators = builtins.filter (
      val:
      val != pantheon.wingpanel-indicator-bluetooth
      || val != pantheon.wingpanel-indicator-network
    ) pantheon.wingpanelIndicators;

    wingpanel-with-indicators = wingpanel.override {
      useDefaultIndicators = false;
      indicators = wingpanelIndicators;
    };
  in
  {
    pantheon = pantheon // {
      inherit wingpanel-with-indicators;
    };
  }
)

but unfortunately all of the indicators are still being pulled into:

wingpanel: βˆ… β†’ 3.0.5, +557.6 KiB
wingpanel-applications-menu: βˆ… β†’ 2.11.1, +1322.3 KiB
wingpanel-indicator-a11y: βˆ… β†’ 1.0.2, +250.0 KiB
wingpanel-indicator-bluetooth: βˆ… β†’ 7.0.1, +764.2 KiB
wingpanel-indicator-datetime: βˆ… β†’ 2.4.1, +412.4 KiB
wingpanel-indicator-keyboard: βˆ… β†’ 2.4.1, +272.3 KiB
wingpanel-indicator-network: βˆ… β†’ 7.1.0, +502.7 KiB
wingpanel-indicator-nightlight: βˆ… β†’ 2.1.2, +288.4 KiB
wingpanel-indicator-notifications: βˆ… β†’ 7.1.0, +444.6 KiB
wingpanel-indicator-power: βˆ… β†’ 6.2.1, +612.9 KiB
wingpanel-indicator-session: βˆ… β†’ 2.3.1, +422.2 KiB
wingpanel-indicator-sound: βˆ… β†’ 7.0.0, +641.7 KiB
wingpanel-with-indicators: βˆ… β†’ 3.0.5, +939.6 KiB

What am I doing wrong? Thanks in advance :man_bowing:

pantheon forms its own self-referencing attribute set (scope). Consequently, if you just update the attribute set in an overlay using //, only references outside the scope will see the new value. The packages within the scope (in this case elementary-greeter) will keep referring to the old one. If you want to override packages within a scope, you need to use overrideScope.

Did not test but something like the following should do it:

(
  self:
  super:
  {
    pantheon = super.pantheon.overrideScope (pfinal: pprev: {
      wingpanel-with-indicators = pprev.wingpanel-with-indicators.override {
        useDefaultIndicators = false;
        indicators = builtins.filter (
          val:
          val != pfinal.wingpanel-indicator-bluetooth
          || val != pfinal.wingpanel-indicator-network
        ) pprev.wingpanelIndicators;
      };
    });
  }
)

Or, since wingpanel-with-plugins references wingpanelIndicators within the scope, override that:

(
  self:
  super:
  {
    pantheon = super.pantheon.overrideScope (pfinal: pprev: {
      wingpanelIndicators = builtins.filter (
        val:
        val != pfinal.wingpanel-indicator-bluetooth
        || val != pfinal.wingpanel-indicator-network
      ) pprev.wingpanelIndicators;
    });
  }
)
1 Like

Thank you very much! This is the first time I ran into scopes, so was very confusing. Spent a bunch of time reading up on this and now it makes total sense. Appreciate the help!