diff options
| author | tv <tv@krebsco.de> | 2026-11-14 00:27:45 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-14 01:46:01 +0100 |
| commit | a4540a584d762b000b21cb7e61987c414eb72a1d (patch) | |
| tree | 077bb7dfc4d104e5e133ad96c4485ff99bcd14c5 /lib/types/posix.nix | |
| parent | 8f08426ae3a2e5f0ecc5d010bc6469b41e3d7678 (diff) | |
populate: layer populate below krops
populate is a program of its own, with a Nix library, in pkgs/populate,
which krops uses, and which doesn't use krops:
- default.nix builds the program, with nix-build there or callPackage,
as pkgs.populate-unwrapped.
- lib is populate's Nix library: the types of sources and the POSIX
types they use, evalSource, flakeFollows, hasGeneratedFlake, and
derivesFlake, taking nixpkgs' lib. krops' lib takes them from there,
so it provides them as before, and so does lib/types.
pkgs.populate, the function from populate's arguments to a script
running the program, is krops' own, in pkgs/krops/populate.nix, with
checks.nix next to it. It takes the program as populate-unwrapped,
which callPackage passes from the overlay; the flake, whose nixpkgs
lacks it, passes its own.
Diffstat (limited to 'lib/types/posix.nix')
| -rw-r--r-- | lib/types/posix.nix | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/types/posix.nix b/lib/types/posix.nix deleted file mode 100644 index e8f464e..0000000 --- a/lib/types/posix.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ lib }: rec { - - # RFC952, B. Lexical grammar, <hname> - hostname = lib.mkOptionType { - name = "hostname"; - check = x: lib.isString x && lib.all label.check (lib.splitString "." x); - merge = lib.mergeOneOption; - }; - - # RFC952, B. Lexical grammar, <name> - # RFC1123, 2.1 Host Names and Numbers - label = lib.mkOptionType { - name = "label"; - # TODO case-insensitive labels - check = lib.test "[0-9A-Za-z]([0-9A-Za-z-]*[0-9A-Za-z])?"; - merge = lib.mergeOneOption; - }; - - # POSIX.1‐2013, 3.278 Portable Filename Character Set - filename = lib.mkOptionType { - name = "POSIX filename"; - check = lib.test "([0-9A-Za-z._])[0-9A-Za-z._-]*"; - merge = lib.mergeOneOption; - }; - - # POSIX.1‐2013, 3.2 Absolute Pathname - absolute-pathname = lib.mkOptionType { - name = "POSIX absolute pathname"; - check = x: lib.isString x && lib.substring 0 1 x == "/" && pathname.check x; - merge = lib.mergeOneOption; - }; - - # POSIX.1‐2013, 3.267 Pathname - pathname = lib.mkOptionType { - name = "POSIX pathname"; - check = x: - let - # The filter is used to normalize paths, i.e. to remove duplicated and - # trailing slashes. It also removes leading slashes, thus we have to - # check for "/" explicitly below. - xs = lib.filter (s: lib.stringLength s > 0) (lib.splitString "/" x); - in - lib.isString x && (x == "/" || (lib.length xs > 0 && lib.all filename.check xs)); - merge = lib.mergeOneOption; - }; - - # POSIX.1-2013, 3.431 User Name - username = lib.mkOptionType { - name = "POSIX username"; - check = filename.check; - merge = lib.mergeOneOption; - }; - -} |
