Skip to content

Conversation

KaiStarkk
Copy link

feat(tuigreet): add TUIgreet target and ANSI theme helpers

Introduces first-class support for TUIgreet by generating an ANSI theme derived from the active Base16 scheme. Also includes a warning scheme nudging users to wire it into greetd, but does not interact with their configuration directly (intentionally -- user config is out of scope).

  • Add config.lib.stylix.ansi helpers:
    • themeMapNearest: maps UI components to the nearest ANSI color name.
    • themeStringNearest: produces a single-line --theme string like text=…;time=…;….
    • Uses Base16 RGB (converted to integers) and a nearest-color search against the 16 standard ANSI names, including hyphenated brights: bright-black, bright-red, bright-green, bright-yellow, bright-blue, bright-magenta, bright-cyan, bright-white.
  • Import ANSI helpers into core Stylix defaults so they are available in all evaluations.
  • New NixOS target tuigreet:
    • Auto-enables when services.greetd.enable = true and its default_session.command contains “tuigreet”.
    • Writes /etc/tuigreet/stylix.theme with the computed --theme string (newline-terminated).
    • Emits a warning if TUIgreet is detected but --theme is not present in the greetd command.
  • No CLI changes required; users reference the generated file at runtime:
    • Example: --theme "$(cat /etc/tuigreet/stylix.theme)".

Testing performed

  • Evaluations to validate config.lib.stylix.ansi.themeStringNearest and ensure the file is generated as /etc/tuigreet/stylix.theme.
  • Tested in local environment with --override-inputs to confirm correct functioning.

  • I certify that I have the right to submit this contribution under the MIT license
  • Commit messages adhere to Stylix commit conventions
  • N/A - Theming changes adhere to the Stylix style guide
  • Changes have been tested locally
  • Changes have been tested in testbeds
  • Each commit in this PR is suitable for backport to the current stable branch

@stylix-automation stylix-automation bot added topic: nixos NixOS target topic: home-manager Home Manager target topic: modules /modules/ subsystem topic: stylix /stylix/ subsystem labels Sep 8, 2025
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.

The pre-commit and treefmt checks are failing. Also, add a testbed for this new module.

The PR is very verbose, hard to understand, and does seemingly unnecessary things. This needs an overhaul or further explanations.

Was this generated with the help of AI?

{
name = "TUIgreet";
homepage = "https://github.com/apognu/tuigreet";
maintainers = [];
Copy link
Member

Choose a reason for hiding this comment

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

New modules must have maintainers.

Copy link
Member

Choose a reason for hiding this comment

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

Why add a new public function for a single module?

@trueNAHO trueNAHO added the backport: release-25.05 Changes to release-25.05 stable branch label Sep 15, 2025
@KaiStarkk
Copy link
Author

KaiStarkk commented Sep 18, 2025

I see a few questions spread throughout comments. Responding here:

  1. Why add a new public function for a single module?

The function is quite generic (ANSI mapping) and not specific to TUIgreet, so it seemed better to make it public, as it might be accessed in the future for modules theming other tools that require ANSI colours.

  1. pre-commit and treefmt checks are failing.

Seems to me to be issues with the checks related to formatting. If different and specific versions of the formatter are required on different architectures (unclear why that would be), this might be best to explain in contrib, or better to include in workspace settings.

  1. Also, add a testbed for this new module.

Don't have capacity for TDD on a relatively tiny module. Others feel free to contribute.

  1. The PR is very verbose, hard to understand, and does seemingly unnecessary things. This needs an overhaul or further explanations.

It's a single commit with probably 20 lines of code if you exclude colour definitions.

  1. New modules need maintainers

That's stylix's prerogative, I'm just providing useful code. Users of TUIgreet can cherry pick the commit if they need this.

  1. Was this generated with the help of AI?

No. Was this review automated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: release-25.05 Changes to release-25.05 stable branch topic: home-manager Home Manager target topic: modules /modules/ subsystem topic: nixos NixOS target topic: stylix /stylix/ subsystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants