Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] nixos: add environment.gnome3.enableExtensions #46433

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bjornfor
Copy link
Contributor

@bjornfor bjornfor commented Sep 9, 2018

Motivation for this change

I'd like to enable/disable GNOME3 extensions from configuration.nix. However, when testing this I learned that services.xserver.desktopManager.gnome3.extraGSettingsOverrides, which this is built upon, only provides default values for the system. Users are still able to change settings. And once they have made a change, any change to the system default will be ignored. This is marked WIP since I'd like for this setting to be truly declarative. The first 4 commits would be nice to merge anyway, so one can play with this locally at least.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@bjornfor bjornfor added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: GNOME GNOME desktop environment and its underlying platform labels Sep 9, 2018
@GrahamcOfBorg GrahamcOfBorg added 8.has: documentation 8.has: module (update) This PR changes an existing module in `nixos/` labels Sep 9, 2018
@hedning
Copy link
Contributor

hedning commented Sep 10, 2018

dconf settings are stored per user (under ~/.config/dconf), so it would be hard to enforce fully I think.

But something like running dconf reset /org/gnome/shell/enabled-extensions as the user on startup might work OK though?

@bjornfor
Copy link
Contributor Author

dconf settings are stored per user (under ~/.config/dconf), so it would be hard to enforce fully I think.

According to this, one should be able to create lock files that prevent users from doing modifications. In my last fixup commit you can see I try to use it, but it didn't work for me.

Your "dconf reset ..." command sounds good. What setting in NixOS is best for running commands at user login time? (I'd like something shell agnostic.)

@bjornfor
Copy link
Contributor Author

Well, the commit that tries to create dconf lock files does not do the "dconf update" step. I did that manually.

@ryantm ryantm added the 2.status: work-in-progress This PR isn't done label Feb 24, 2019
@jtojnar
Copy link
Member

jtojnar commented Apr 5, 2019

See also #54150

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/recommended-way-to-add-gnome-extensions/5589/3

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 and removed 8.has: documentation labels May 9, 2020
This option takes a list of packages / GNOME extensions that will be
(declaratively) enabled. The default value is null, meaning the
extensions are managed imperatively (backwards compatible).
Try to add add a lock file, to prevent users from modifying / overriding
the system (default) settings. However, it doesn't work.
@bbigras
Copy link
Contributor

bbigras commented Jul 16, 2020

Any progress on this?

@bjornfor
Copy link
Contributor Author

Not from my side.

@bbigras
Copy link
Contributor

bbigras commented Jul 16, 2020

What is needed to move this PR forward?

Does #54150 needs to be done first?

@bjornfor
Copy link
Contributor Author

Does #54150 needs to be done first?

Yep, that's what I'm thinking.

@ryantm ryantm marked this pull request as draft October 23, 2020 03:12
@SuperSandro2000 SuperSandro2000 added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 18, 2021
@stale
Copy link

stale bot commented Jul 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 21, 2021
@Alizter
Copy link
Contributor

Alizter commented Mar 12, 2023

Any news on this?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 12, 2023
@bjornfor
Copy link
Contributor Author

Any news on this?

No, #54150 still needs to land first.

@linsui
Copy link
Contributor

linsui commented Sep 1, 2023

You can use the dconf module now.

@bjornfor
Copy link
Contributor Author

bjornfor commented Sep 1, 2023

You can use the dconf module now.

Right, there was another PR (not linked here) that fixed it! Cool!

I'll put this back on my TODO list.

@ulysses4ever
Copy link
Contributor

#54150 has ben merged. Anything else left before this one can land?

@bjornfor
Copy link
Contributor Author

#54150 has ben merged. Anything else left before this one can land?

This PR needs a rewrite. It's not high priority for me, as I'm using home-manager for my gnome extensions. Someone please make new PR on top of #54150.

@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 19, 2024
@WillsterJohnson
Copy link

#54150 has ben merged. Anything else left before this one can land?

This PR needs a rewrite. It's not high priority for me, as I'm using home-manager for my gnome extensions. Someone please make new PR on top of #54150.

How are you doing this via home-manager? I looked at your repo but I see it's been a while since that mirror got an update

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Oct 27, 2024
@bjornfor
Copy link
Contributor Author

How are you doing this via home-manager?

Using the dconf module. For example:

{ pkgs, lib, ... }:

let
  # Make widgets smaller to not clip other widgets (default: 100).
  graphWidth = 95;
in
{
  dconf.settings."org/gnome/shell".enabled-extensions = [
    pkgs.gnomeExtensions.system-monitor-next.extensionUuid
  ];

  dconf.settings = {
    "org/gnome/shell/extensions/system-monitor" = {
      # Highlight IO wait with dark red
      cpu-iowait-color = "#a40000ff";

      disk-display = true;
      # In the default color scheme it's impossible to separate reads and
      # writes.
      disk-read-color = "#00ff00ff"; # bright green
      disk-write-color = "#ff0000ff"; # bright red

      cpu-graph-width = graphWidth;
      memory-graph-width = graphWidth;
      net-graph-width = graphWidth;
      disk-graph-width = graphWidth;
    };
  };
}

I looked at your repo but I see it's been a while since that mirror got an update

Yes, I intentionally stopped updating it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: work-in-progress This PR isn't done 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.