From e4d427602c229a782297a74b50b2f67524e9e0d6 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 21 Feb 2016 06:38:09 +0100 Subject: krebs.types.user: add home :: absolute-pathname --- krebs/4lib/types.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'krebs/4lib') diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix index 55301add5..41af1cd4f 100644 --- a/krebs/4lib/types.nix +++ b/krebs/4lib/types.nix @@ -165,6 +165,10 @@ types // rec { user = submodule ({ config, ... }: { options = { + home = mkOption { + type = absolute-pathname; + default = "/home/${config.name}"; + }; mail = mkOption { type = str; # TODO retiolum mail address }; @@ -226,6 +230,21 @@ types // rec { merge = mergeOneOption; }; + # POSIX.1‐2013, 3.2 Absolute Pathname + # TODO normalize slashes + # TODO two slashes + absolute-pathname = mkOptionType { + name = "POSIX absolute pathname"; + check = s: pathname.check s && substring 0 1 s == "/"; + }; + + # POSIX.1‐2013, 3.267 Pathname + # TODO normalize slashes + pathname = mkOptionType { + name = "POSIX pathname"; + check = s: isString s && all filename.check (splitString "/" s); + }; + # POSIX.1-2013, 3.431 User Name username = mkOptionType { name = "POSIX username"; -- cgit v1.2.3