summaryrefslogtreecommitdiffstats
path: root/krebs/4lib/types.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-02-21 06:38:09 +0100
committertv <tv@krebsco.de>2016-02-21 06:42:01 +0100
commite4d427602c229a782297a74b50b2f67524e9e0d6 (patch)
treed5568135d9bee67c029d1858affdf627df8afa88 /krebs/4lib/types.nix
parentd5db8b88edbf40df3b48364429310872edb64cea (diff)
krebs.types.user: add home :: absolute-pathname
Diffstat (limited to 'krebs/4lib/types.nix')
-rw-r--r--krebs/4lib/types.nix19
1 files changed, 19 insertions, 0 deletions
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";