From f121a142abde1b6aa9738e4c21a330c0ddd4eb70 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Sun, 23 Feb 2025 19:17:59 +0100 Subject: [PATCH] stylix: parametrize and change testbed field separator (#887) Parametrize and change the testbed field separator to the colon (':') character to avoid ambiguity with module names containing hyphens ('-'), and allow testbed names to contain hyphens. Fixes: 211a8440e7eb ("stylix: support multiple testbeds per module (#858)") --- README.md | 4 ++-- ...lt-dark.png => testbed_gnome_default_dark.png} | Bin docs/src/testbeds.md | 14 +++++++------- stylix/testbed.nix | 12 +++++++++--- 4 files changed, 18 insertions(+), 12 deletions(-) rename docs/src/{testbed-gnome-default-dark.png => testbed_gnome_default_dark.png} (100%) diff --git a/README.md b/README.md index 8be89a42..298a0347 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,8 @@ Photos by [Clay Banks](https://unsplash.com/photos/three-bicycles-parked-in-fron and [Derrick Cooper](https://unsplash.com/photos/brown-road-in-forest-during-daytime-L505cPnmIds). Try a live demo of this theme by running -`nix run github:danth/stylix#testbed-gnome-default-light` or -`nix run github:danth/stylix#testbed-gnome-default-dark`. +`nix run github:danth/stylix#testbed:gnome:default:light` or +`nix run github:danth/stylix#testbed:gnome:default:dark`. ### KDE Plasma 5 diff --git a/docs/src/testbed-gnome-default-dark.png b/docs/src/testbed_gnome_default_dark.png similarity index 100% rename from docs/src/testbed-gnome-default-dark.png rename to docs/src/testbed_gnome_default_dark.png diff --git a/docs/src/testbeds.md b/docs/src/testbeds.md index 959b22b5..cbaa89b1 100644 --- a/docs/src/testbeds.md +++ b/docs/src/testbeds.md @@ -52,19 +52,19 @@ github:danth/stylix └───x86_64-linux ├───docs: package 'stylix-book' ├───palette-generator: package 'palette-generator' - ├───testbed-gnome-default-dark: package 'testbed-gnome-default-dark' - ├───testbed-gnome-default-light: package 'testbed-gnome-default-light' - ├───testbed-kde-default-dark: package 'testbed-kde-default-dark' - └───testbed-kde-default-light: package 'testbed-kde-default-light' + ├───testbed:gnome:default:dark: package 'testbed:gnome:default:dark' + ├───testbed:gnome:default:light: package 'testbed:gnome:default:light' + ├───testbed:kde:default:dark: package 'testbed:kde:default:dark' + └───testbed:kde:default:light: package 'testbed:kde:default:light' ``` (This has been edited down to only the relevant parts.) To start a testbed, each of which is named in the format -`testbed-«module»-«testbed»-«polarity»`, run the following command: +`testbed:«module»:«testbed»:«polarity»`, run the following command: ```console -user@host:~$ nix run .#testbed-«module»-«testbed»-«polarity» +user@host:~$ nix run .#testbed:«module»:«testbed»:«polarity» ``` Any package with a name not fitting the given format is not a testbed, @@ -74,7 +74,7 @@ Once the virtual machine starts, a window should open, similar to the screenshot below. The contents of the virtual machine will vary depending on the target you selected earlier. -![GDM login screen with a dark background color and showing a guest user](testbed-gnome-default-dark.png) +![GDM login screen with a dark background color and showing a guest user](testbed_gnome_default_dark.png) If the testbed includes a login screen, the guest user should log in automatically when selected. Depending on the software used, you may still be diff --git a/stylix/testbed.nix b/stylix/testbed.nix index ab7f1e9b..0d20bd49 100644 --- a/stylix/testbed.nix +++ b/stylix/testbed.nix @@ -6,6 +6,7 @@ }: let + testbedFieldSeparator = ":"; username = "guest"; commonModule = @@ -114,8 +115,8 @@ let # To prevent ambiguity with the final derivation's hyphen field # separator, testbed names should not contain hyphens. - else if lib.hasInfix "-" testbed then - builtins.throw "testbed name must not contain hyphens (-): ${testbed}" + else if lib.hasInfix testbedFieldSeparator testbed then + builtins.throw "testbed name must not contain the '${testbedFieldSeparator}' testbed field separator: ${testbed}" else { @@ -131,7 +132,12 @@ let makeTestbed = testbed: stylix: let - name = "testbed-${testbed.module}-${testbed.name}-${stylix.polarity}"; + name = builtins.concatStringsSep testbedFieldSeparator [ + "testbed" + testbed.module + testbed.name + stylix.polarity + ]; system = lib.nixosSystem { inherit (pkgs) system;