From 9872ea9a0c045948eddd9d319360db24128b559f Mon Sep 17 00:00:00 2001 From: oluceps Date: Sat, 21 Sep 2024 22:19:58 +0800 Subject: [PATCH] chore(dae): refine configFile type --- dae/module.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dae/module.nix b/dae/module.nix index 03c4d50..ac43fb3 100644 --- a/dae/module.nix +++ b/dae/module.nix @@ -87,12 +87,20 @@ in }; configFile = mkOption { - type = with types; (nullOr path); + type = + let + inherit (types) nullOr addCheck str; + isAbsolutePathString = x: lib.substring 0 1 x == "/"; + in + (nullOr (addCheck str isAbsolutePathString)) + // { + description = "${types.str.description} (with check: is absolute path string)"; + }; default = null; - example = "/path/to/your/config.dae"; + example = ''"/path/to/your/config.dae"''; description = '' - The path of dae config file, end with `.dae`. - Will fallback to `/etc/dae/config.dae` if this is not set. + The absolute path string of dae config file, end with `.dae`. + Will fallback to `"/etc/dae/config.dae"` if this is not set. ''; };