# How to disable some panels in GNOME control center

**URL:** https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048
**Category:** Uncategorized
**Created:** [November 26, 2023, 5:57pm UTC](https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048 "2023-11-26T17:57:11Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![vccs](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/v/cab0a1/32.png) [@vccs](https://discourse.nixos.org/u/vccs)
#### Post date: [November 26, 2023, 5:57pm UTC](https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048/1 "2023-11-26T17:57:11Z")

</div>

> [@Howto: Disable most gnome default applications (and what they are)](https://discourse.nixos.org/t/howto-disable-most-gnome-default-applications-and-what-they-are/13505/14):
>
> `current-system` is just another immutable package that symlinks stuff in `environment.systemPackages` ([built with `buildEnv`](https://github.com/NixOS/nixpkgs/blob/a3a38f810bd9e327282d21da781fc8f96faee81b/nixos/modules/config/system-path.nix#L168)).
> 
> You could inject extra code to [`environment.extraSetup`](https://nixos.org/manual/nixos/unstable/options.html#opt-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`](https://nixos.org/manual/nixos/unstable/options#opt-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.

The panels can be disabled by remove the corresponding desktop files according to [https://askubuntu.com/questions/442520/is-it-possible-to-remove-items-from-system-settings](https://askubuntu.com/questions/442520/is-it-possible-to-remove-items-from-system-settings). But it’s not easy on NixOS. I tried to add a dummy package with empty desktop files. But it doesn’t work. Maybe it’s easier to create a wrapper for GNOME control center.

---

<div class="post-metadata">

### Author: ![jtojnar](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jtojnar/32/70_2.png) [@jtojnar](https://discourse.nixos.org/u/jtojnar)
#### Post date: [November 26, 2023, 6:19pm UTC](https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048/2 "2023-11-26T18:19:53Z")

</div>

What exactly did you try?

---

<div class="post-metadata">

### Author: ![vccs](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/v/cab0a1/32.png) [@vccs](https://discourse.nixos.org/u/vccs)
#### Post date: [November 26, 2023, 6:54pm UTC](https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048/3 "2023-11-26T18:54:51Z")

</div>

```nix
    (pkgs.writeTextFile {
      name = "gnome-online-accounts-panel";
      text = "";
      destination = "/share/applications/gnome-online-accounts-panel.desktop";
    })

```

Add this to systemPackages, then the gnome-online-accounts-panel.desktop in current-system will be an empty file. But the panel is still there. I tested patching the package and it does work by removing the file. But I don’t want to add another minute when I rebuilding the system so I’ll use a wrapper.

---

<div class="post-metadata">

### Author: ![vccs](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/v/cab0a1/32.png) [@vccs](https://discourse.nixos.org/u/vccs)
#### Post date: [November 26, 2023, 7:29pm UTC](https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048/4 "2023-11-26T19:29:06Z")

</div>

```auto
      gnome = super.gnome // {
        gnome-control-center = super.runCommand "gnome-control-center" { } ''
          mkdir -p $out
          ${super.xorg.lndir}/bin/lndir -silent ${super.gnome.gnome-control-center} $out
          rm $out/share/applications/gnome-{online-accounts,sharing}-panel.desktop
        '';
      };

```

This doesn’t work either. I guess it looks at the original path.

---

<div class="post-metadata">

### Author: ![jtojnar](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jtojnar/32/70_2.png) [@jtojnar](https://discourse.nixos.org/u/jtojnar)
#### Post date: [November 26, 2023, 8:32pm UTC](https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048/5 "2023-11-26T20:32:48Z")

</div>

Right, try copying the files and then `sed`ing the original path for the new one.

---

<div class="post-metadata">

### Author: ![vccs](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/v/cab0a1/32.png) [@vccs](https://discourse.nixos.org/u/vccs)
#### Post date: [November 27, 2023, 6:49am UTC](https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048/6 "2023-11-27T06:49:19Z")

</div>

```nix
      gnome = super.gnome // {
        gnome-control-center = super.runCommand "gnome-control-center" { } ''
          cp -R ${super.gnome.gnome-control-center} $out
          chmod -R +w $out
          rm $out/share/applications/gnome-{online-accounts,sharing}-panel.desktop
          find $out -type f -exec sed -i -e "s|${super.gnome.gnome-control-center}|$out|g" {} \;
        '';
      };
    })

```

This doesn’t work either.

---

<div class="post-metadata">

### Author: ![vccs](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/v/cab0a1/32.png) [@vccs](https://discourse.nixos.org/u/vccs)
#### Post date: [December 4, 2023, 2:12pm UTC](https://discourse.nixos.org/t/how-to-disable-some-panels-in-gnome-control-center/36048/7 "2023-12-04T14:12:16Z")

</div>

I know why it didn’t work. The path must has same length so the name should match. This is the working code:

```nix
      gnome = super.gnome // {
        gnome-control-center = super.runCommand "${super.gnome.gnome-control-center.name}" { } ''
          cp -R ${super.gnome.gnome-control-center} $out
          chmod -R +w $out
          rm $out/share/applications/gnome-{online-accounts,sharing}-panel.desktop
          find $out -type f -exec sed -i -e "s|${super.gnome.gnome-control-center}|$out|g" {} \;
        '';
      };

```
