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

nixos/gtk.iconCache: Disable by default #50453

Closed
wants to merge 1 commit into from

Conversation

srhb
Copy link
Contributor

@srhb srhb commented Nov 16, 2018

Motivation for this change

Unblock the installer tests.

Discussion has been taking place (#48116) on how to default enable this in eg. xserver.enable or something similar, but as far as I can tell nothing has been concluded yet. Meanwhile, on a barebones system this should surely be false, so this seems like the right default in the module itself.

cc @romildo @matthewbauer

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.

@lopsided98
Copy link
Contributor

Won't this break people's setups unless we automatically enable the module when it is needed?

@infinisil
Copy link
Member

Oh, um good point.. Maybe it should be conditional on xserver.enable after all?

@matthewbauer
Copy link
Member

I didn't realize this would happen with that PR! I think the issue comes from the usage of ${pkgs.gtk3.out}/bin/gtk-update-icon-cache in the new gtk module and the old usage of $out/bin/gtk-update-icon-cache. So previously you needed gtk3 to be in your systemPackages to generate modules. This is a bad thing to do - you cannot assume that you can execute systemPackages on your build system! But it has the advantage of not pulling in gtk3 when you don't want it. It should be noted that you won't get gtk3 in your outputs, though, this is just a build time dependency.

Thanks for tracking this down! I think this PR is good as is, although it would be nice to have the module enabled when icons are expected to be in systemPackages though.

@vcunat
Copy link
Member

vcunat commented Nov 17, 2018

Right, xserver.enable seems a strictly better approximation: 80738ed.

@vcunat vcunat closed this Nov 17, 2018
@romildo
Copy link
Contributor

romildo commented Nov 17, 2018

I was going to make a PR where gtk.iconCache is disabled in module gtk-icon-cache and enabled in modules xserver, sway, sway-beta and way-cooler

From 0551eb95b77b97b04ceb4fe0d81d16d8151e2602 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= <malaquias@gmail.com>
Date: Sat, 17 Nov 2018 08:29:31 -0200
Subject: [PATCH] nixos gtk.iconCache.enable: default on X11 and wayland

---
 nixos/modules/config/gtk/gtk-icon-cache.nix | 8 ++++++--
 nixos/modules/programs/sway-beta.nix        | 4 ++++
 nixos/modules/programs/sway.nix             | 5 +++++
 nixos/modules/programs/way-cooler.nix       | 4 ++++
 nixos/modules/services/x11/xserver.nix      | 4 ++++
 5 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/nixos/modules/config/gtk/gtk-icon-cache.nix b/nixos/modules/config/gtk/gtk-icon-cache.nix
index d4e0cf97c66..37abe7608f7 100644
--- a/nixos/modules/config/gtk/gtk-icon-cache.nix
+++ b/nixos/modules/config/gtk/gtk-icon-cache.nix
@@ -5,9 +5,13 @@ with lib;
   options = {
     gtk.iconCache.enable = mkOption {
       type = types.bool;
-      default = true;
+      default = false;
       description = ''
-        Whether to build icon theme caches for GTK+ applications.
+        Whether to build icon theme caches for GTK+ applications. It is
+        disabled in general, and enabled (in the corresponding module) for
+        systems that are GTK+ backends, like X11 and wayland. You do not
+        usually have to set it yourself, only if there is no module for the
+        GDK backend you want to use.
       '';
     };
   };
diff --git a/nixos/modules/programs/sway-beta.nix b/nixos/modules/programs/sway-beta.nix
index e651ea4cca3..06629bb0aac 100644
--- a/nixos/modules/programs/sway-beta.nix
+++ b/nixos/modules/programs/sway-beta.nix
@@ -73,6 +73,10 @@ in {
     hardware.opengl.enable = mkDefault true;
     fonts.enableDefaultFonts = mkDefault true;
     programs.dconf.enable = mkDefault true;
+
+    # Enable icon theme cache generation for GTK+ applications
+    # (wayland is one of the backends for GTK+ applications)
+    gtk.iconCache.enable = true;
   };
 
   meta.maintainers = with lib.maintainers; [ gnidorah primeos colemickens ];
diff --git a/nixos/modules/programs/sway.nix b/nixos/modules/programs/sway.nix
index 0eaaf6b85b9..d9c315c9105 100644
--- a/nixos/modules/programs/sway.nix
+++ b/nixos/modules/programs/sway.nix
@@ -79,6 +79,11 @@ in {
     hardware.opengl.enable = mkDefault true;
     fonts.enableDefaultFonts = mkDefault true;
     programs.dconf.enable = mkDefault true;
+
+    # Enable icon theme cache generation for GTK+ applications
+    # (wayland is one of the backends for GTK+ applications)
+    gtk.iconCache.enable = true;
+
   };
 
   meta.maintainers = with lib.maintainers; [ gnidorah primeos ];
diff --git a/nixos/modules/programs/way-cooler.nix b/nixos/modules/programs/way-cooler.nix
index 633e959be9f..68be7de0747 100644
--- a/nixos/modules/programs/way-cooler.nix
+++ b/nixos/modules/programs/way-cooler.nix
@@ -72,6 +72,10 @@ in
     hardware.opengl.enable = mkDefault true;
     fonts.enableDefaultFonts = mkDefault true;
     programs.dconf.enable = mkDefault true;
+
+    # Enable icon theme cache generation for GTK+ applications
+    # (wayland is one of the backends for GTK+ applications)
+    gtk.iconCache.enable = true;
   };
 
   meta.maintainers = with maintainers; [ gnidorah ];
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index 34ae8c11a3f..ae2e919bf05 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -639,6 +639,10 @@ in
       icons.enable = true;
     };
 
+    # Enable icon theme cache generation for GTK+ applications (X11 is
+    # one of the backends for GTK+ applications)
+    gtk.iconCache.enable = true;
+
     # The default max inotify watches is 8192.
     # Nowadays most apps require a good number of inotify watches,
     # the value below is used by default on several other distros.
-- 
2.19.1

@vcunat Should I submit it?

@srhb srhb deleted the disable-gtk-iconCache branch November 18, 2018 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants