summaryrefslogtreecommitdiffstats
path: root/krebs/4lib/types.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-06-12 17:49:59 +0200
committermakefu <github@syntax-fehler.de>2016-06-12 17:49:59 +0200
commited1d336fc85935b73d9f8a2486ea3e95503ab655 (patch)
treec5b57637a8a6c283ee5bb2608d6412edac9bd1c6 /krebs/4lib/types.nix
parent19d5be268368f073401d07f6657cf61827c9d59c (diff)
parentfb8be5838adfe58fc5d13235ac82022cbdb8f6e4 (diff)
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'krebs/4lib/types.nix')
-rw-r--r--krebs/4lib/types.nix23
1 files changed, 15 insertions, 8 deletions
diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix
index 66191d0b..678ae7a6 100644
--- a/krebs/4lib/types.nix
+++ b/krebs/4lib/types.nix
@@ -154,6 +154,12 @@ types // rec {
merge = mergeOneOption;
};
+ uint = mkOptionType {
+ name = "unsigned integer";
+ check = x: isInt x && x >= 0;
+ merge = mergeOneOption;
+ };
+
secret-file = submodule ({ config, ... }: {
options = {
path = mkOption { type = str; };
@@ -199,8 +205,9 @@ types // rec {
description = ''
Set of user's PGP public keys.
- Modules supporting PGP may use well-known key names to define option
- defaults, e.g. using `getAttrDef well-known-name pubkeys`.
+ Modules supporting PGP may use well-known key names to define
+ default values for options, in which case the well-known name
+ should be documented in the respective option's description.
'';
};
pubkey = mkOption {
@@ -318,10 +325,7 @@ types // rec {
# POSIX.1‐2013, 3.278 Portable Filename Character Set
filename = mkOptionType {
name = "POSIX filename";
- check = let
- filename-chars = stringToCharacters
- "-.0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- in s: all (flip elem filename-chars) (stringToCharacters s);
+ check = x: match "([0-9A-Za-z._])[0-9A-Za-z._-]*" x != null;
merge = mergeOneOption;
};
@@ -330,7 +334,8 @@ types // rec {
# TODO two slashes
absolute-pathname = mkOptionType {
name = "POSIX absolute pathname";
- check = s: pathname.check s && substring 0 1 s == "/";
+ check = s: s == "/" || (pathname.check s && substring 0 1 s == "/");
+ merge = mergeOneOption;
};
# POSIX.1‐2013, 3.267 Pathname
@@ -338,11 +343,13 @@ types // rec {
pathname = mkOptionType {
name = "POSIX pathname";
check = s: isString s && all filename.check (splitString "/" s);
+ merge = mergeOneOption;
};
# POSIX.1-2013, 3.431 User Name
username = mkOptionType {
name = "POSIX username";
- check = s: filename.check s && substring 0 1 s != "-";
+ check = filename.check;
+ merge = mergeOneOption;
};
}