From fc80de87685515edc6bc8ace4934be2c551f374b Mon Sep 17 00:00:00 2001 From: Antoine Carnec Date: Sun, 13 Nov 2022 15:50:33 +0000 Subject: [PATCH] fix: Added type check for packagesDir option --- src/modules/config/interface.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/modules/config/interface.nix b/src/modules/config/interface.nix index 3695f655..7ce6c4f6 100644 --- a/src/modules/config/interface.nix +++ b/src/modules/config/interface.nix @@ -1,6 +1,16 @@ {lib, ...}: let l = lib // builtins; t = l.types; + + relativePathString = l.types.mkOptionType { + name = "relativePathString"; + description = "Relative path in a string."; + check = s: + (t.str.check s) + && (l.substring 0 2 s == "./"); + descriptionClass = "noun"; + inherit (t.str) merge; + }; in { options = { disableIfdWarning = l.mkOption { @@ -18,7 +28,7 @@ in { ''; }; packagesDir = l.mkOption { - type = t.str; + type = relativePathString; default = "./dream2nix-packages"; description = '' Relative path to the project root to put generated dream-lock files in.