Skip to content

Conversation

@0xda157
Copy link
Contributor

@0xda157 0xda157 commented Dec 26, 2025

relevant: #2107 (comment)

GTKSourceView is disabled by default because it causes many packages
to no longer be cached in hydra, forcing the user to compile these
packages themselves.

Note

this is a breaking change, so only gtksourceview: use simpler or false in enabled check should be backported.


@stylix-automation stylix-automation bot added topic: nixos NixOS target topic: home-manager Home Manager target topic: overlay Overlay changes topic: testbed Testbed changes topic: modules /modules/ subsystem labels Dec 26, 2025
@stylix-automation stylix-automation bot requested a review from brckd December 26, 2025 20:27
Copy link
Contributor

@brckd brckd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Code and CI looks good.

@danth
Copy link
Member

danth commented Dec 28, 2025

I just opened #2112 with some more ideas around this. We would likely want to disable code patches by default anyway, so this PR shouldn't be blocked by that.

Copy link
Member

@trueNAHO trueNAHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a66458eae1c7c73b5ada93066faaf197f65aa660 Mon Sep 17 00:00:00 2001
From: 0xda157 <[email protected]>
Date: Fri, 26 Dec 2025 12:11:29 -0800
Subject: [PATCH 1/3] gtksourceview: use simpler `or false` in enabled check

---
 modules/gtksourceview/overlay.nix | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/modules/gtksourceview/overlay.nix b/modules/gtksourceview/overlay.nix
index 8c8d5b751..2aac4c69e 100644
--- a/modules/gtksourceview/overlay.nix
+++ b/modules/gtksourceview/overlay.nix
@@ -21,11 +21,7 @@ in
   overlay =
     _final: prev:
     optionalAttrs
-      (
-        config.stylix.enable
-        && config.stylix.targets ? gtksourceview
-        && config.stylix.targets.gtksourceview.enable
-      )
+      (config.stylix.enable && config.stylix.targets.gtksourceview.enable or false)
       {
         gnome2 = prev.gnome2 // {
           gtksourceview = prev.gnome2.gtksourceview.overrideAttrs (attrsOverride "2.0");

LGTM.

From b712de35a85897a60b72d5769b0f83fdb0022667 Mon Sep 17 00:00:00 2001
From: 0xda157 <[email protected]>
Date: Fri, 26 Dec 2025 12:15:42 -0800
Subject: [PATCH 2/3] gtksourceview: disable by default

---
 modules/gtksourceview/hm.nix    | 2 ++
 modules/gtksourceview/meta.nix  | 6 ++++++
 modules/gtksourceview/nixos.nix | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/gtksourceview/hm.nix b/modules/gtksourceview/hm.nix
index 02bf853b8..479bac279 100644
--- a/modules/gtksourceview/hm.nix
+++ b/modules/gtksourceview/hm.nix
@@ -1,5 +1,7 @@
 { mkTarget, lib, ... }:
 mkTarget {
+  autoEnable = false;
+
   config =
     { colors, ... }:
     {
diff --git a/modules/gtksourceview/meta.nix b/modules/gtksourceview/meta.nix
index 3d860e9d1..ca47da57b 100644
--- a/modules/gtksourceview/meta.nix
+++ b/modules/gtksourceview/meta.nix
@@ -2,4 +2,10 @@
 {
   maintainers = [ lib.maintainers.bricked ];
   name = "GTKSourceView";
+  description = ''
+    > [!WARNING]
+    > GTKSourceView is disabled by default because it causes many packages
+    > to no longer be cached in hydra, forcing the user to compile these

Should this refer to hydra or https://cache.nixos.org?

+    > packages themselves.
+  '';
 }
diff --git a/modules/gtksourceview/nixos.nix b/modules/gtksourceview/nixos.nix
index 40f8bd18e..c5c361d6d 100644
--- a/modules/gtksourceview/nixos.nix
+++ b/modules/gtksourceview/nixos.nix
@@ -1,3 +1,3 @@
 { mkTarget, ... }:
 # Used to enable overlay.
-mkTarget { }
+mkTarget { autoEnable = false; }

[...]

I just opened #2112 with some more ideas around this. We would likely want to disable code patches by default anyway, so this PR shouldn't be blocked by that.

Would it not be better to enable as much as possible by default to provide the most feature-complete default experience:

stylix/README.md

Lines 11 to 15 in b135edb

Unlike color scheme utilities such as
[base16.nix](https://github.com/SenchoPens/base16.nix) or
[nix-colors](https://github.com/Misterio77/nix-colors), Stylix goes further by
applying themes to supported applications, following the "it just works"
philosophy.

IMHO, it would be better for users to explicitly opt-out from uncached https://cache.nixos.org packages by disabling relevant modules. Until the #2112 interface is implemented, the "Tips and tricks" (/doc/src/tricks.md) documentation section could list modules that are known to potentially drastically increase build time.

From 036fbc5b0a2fa5e687a871c65cf3915125b869c7 Mon Sep 17 00:00:00 2001
From: 0xda157 <[email protected]>
Date: Fri, 26 Dec 2025 12:22:46 -0800
Subject: [PATCH 3/3] gtksourceview: add testbed

---
 modules/gnome-text-editor/testbeds/gnome-text-editor.nix | 1 +
 modules/gtksourceview/testbeds/gtksourceview.nix         | 5 +++++
 2 files changed, 6 insertions(+)
 create mode 100644 modules/gtksourceview/testbeds/gtksourceview.nix

diff --git a/modules/gnome-text-editor/testbeds/gnome-text-editor.nix b/modules/gnome-text-editor/testbeds/gnome-text-editor.nix
index 2022e2b20..a70579106 100644
--- a/modules/gnome-text-editor/testbeds/gnome-text-editor.nix
+++ b/modules/gnome-text-editor/testbeds/gnome-text-editor.nix
@@ -1,3 +1,4 @@
+# NOTE: ../../gtksourceview/testbeds/gtksourceview.nix depends on this file
 { pkgs, ... }:
 {
   stylix.testbed.ui.command.text = "gnome-text-editor flake-parts/flake.nix";
diff --git a/modules/gtksourceview/testbeds/gtksourceview.nix b/modules/gtksourceview/testbeds/gtksourceview.nix
new file mode 100644
index 000000000..a2b35c801
--- /dev/null
+++ b/modules/gtksourceview/testbeds/gtksourceview.nix
@@ -0,0 +1,5 @@
+{
+  imports = [ ../../gnome-text-editor/testbeds/gnome-text-editor.nix ];
+
+  stylix.targets.gtksourceview.enable = true;
+}

When stylix.targets.gtksourceview.enable stays enabled by default, the following is no longer necessary:

diff --git a/modules/gtksourceview/testbeds/gtksourceview.nix b/modules/gtksourceview/testbeds/gtksourceview.nix
index a2b35c80..4a5ecbbf 100644
--- a/modules/gtksourceview/testbeds/gtksourceview.nix
+++ b/modules/gtksourceview/testbeds/gtksourceview.nix
@@ -1,5 +1,3 @@
 {
   imports = [ ../../gnome-text-editor/testbeds/gnome-text-editor.nix ];
-
-  stylix.targets.gtksourceview.enable = true;
 }

Otherwise, "PATCH 3/3" LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: home-manager Home Manager target topic: modules /modules/ subsystem topic: nixos NixOS target topic: overlay Overlay changes topic: testbed Testbed changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants