"Bug": services.data-mesher.settings.host.names allows values that are not accepted by data-mesher itself #214

Open
opened 2025-05-22 22:40:54 +00:00 by jfly · 1 comment

data-mesher (the go project) has this strict NameRegex regex, but the NixOS module allows for any old str.

It would be nice for users if these 2 regexes were synchronized, as it would push configuration errors into further left (from runtime to evaltime).

Related: #213

data-mesher (the go project) has [this strict `NameRegex` regex](https://git.clan.lol/clan/data-mesher/src/commit/54989ab33b3b5ff5e21e89ce11f0b72b3979ffd6/data-mesher/pkg/config/host.go#L12), but the [NixOS module allows for any old str](https://git.clan.lol/clan/data-mesher/src/commit/54989ab33b3b5ff5e21e89ce11f0b72b3979ffd6/nix/nixosModules/data-mesher/module.nix#L109). It would be nice for users if these 2 regexes were synchronized, as it would push configuration errors into further left (from runtime to evaltime). Related: https://git.clan.lol/clan/data-mesher/issues/213
Member

Would be nice if it was only 1 regex source. But that would also mean to use the same regex engine as nix

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04

Idea:

// file: name-regex
"^[a-z0-9]+$"

then we can just import it in nix

let 
  # could also use readfile, a string is a nix exression, depends if you use quotes in the file
  regex = import "./name-regex";

in 
  match regex name
Would be nice if it was only 1 regex source. But that would also mean to use the same regex engine as nix https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04 Idea: ```json // file: name-regex "^[a-z0-9]+$" ``` then we can just import it in nix ```nix let # could also use readfile, a string is a nix exression, depends if you use quotes in the file regex = import "./name-regex"; in match regex name ```
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: clan/data-mesher#214