1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-27 20:51:03 +01:00

gnome-terminal: add assertion on profile names

This commit is contained in:
Robert Helgesson 2023-07-29 19:01:04 +02:00
parent 5c23226768
commit f58889c07e
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 48 additions and 2 deletions

View file

@ -292,12 +292,30 @@ in {
profile = mkOption {
default = { };
type = types.attrsOf profileSubModule;
description = "A set of Gnome Terminal profiles.";
description = ''
A set of Gnome Terminal profiles. Note, the name of a profile must be
a UUID. You can generate one, for example, using {command}`uuidgen`
(from `util-linux`).
'';
};
};
};
config = mkIf cfg.enable {
assertions = [
(let
uuidre =
"[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}";
erroneous =
filter (n: builtins.match uuidre n == null) (attrNames cfg.profile);
in {
assertion = erroneous == [ ];
message = ''
The attribute name of a Gnome Terminal profile must be a UUID.
Incorrect profile names: ${concatStringsSep ", " erroneous}'';
})
];
home.packages = [ pkgs.gnome.gnome-terminal ];
dconf.settings = let dconfPath = "org/gnome/terminal/legacy";