Aquaris standard library for use in modules.
Functions:
merge: recursiveUpdate folded over a list of valuessubs: Generalized text substitution function. Takes the following parameters as a set:text(string): Text template to apply substitutions tosubs(set of strings): Substitutions that should be applied to the template
subsF: Wrapper forsubsthat reads a file and passes the substituted contents to a function. Takes the following parameters as a set:file(path): Path to the original file that should be readsubs(set of strings): Substitutions that should be applied to the file’s contentfunc: Function that takes the filename and the substituted text and should output the result ofsubsF. Example:pkgs.writeScript
subsT: A specialized version ofsubsFthat just returns the text.readLines: Reads a file and returns the list of lines with\nstrippedimportDir': A function to import Nix files in a directory. Takes two parameters:- a set containing:
default(boolean): shoulddefault.nixbe included? Default: falsedirs(boolean): should directories be included? Default: true
- the directory to import
- a set containing:
importDir: Identical toimportDir' {}aka.: takes a directory, imports all files (exceptdefault.nix) and subdirectories.adt: Converts NixOS submodules into Algebraic Data Types (Wikipedia). Takes a set of submodules, functions to submodules or files containing the previous items. Returns a set of:is.foo: Functions that checks if a given set is an instance of thefoosubmodulemk.foo: Function that converts a given set into an instance of thefoosubmoduletype: Type value suitable forlib.mkOption
The
isandmksubsets include items for all passed submodules (foois just an example)ADT instances are submodules with the added option
_tag, set to the name of the instance. This means a submodulefoopassed toadtwould be given a default_tag = "foo";value.This is used by Aquaris’s filesystem module (the actual type is passed here).