Others
libGit
A small template for doing git kung-fu.
Types:
-
libGit (
package): A package that can be sourced to setup functions in the current scope. The list of available functions is documented below:-
is_git_repository: Return 0 if the provided path is a git repository. -
require_git_repository: Stops the execution if the provided path is not a git repository. -
get_abbrev_rev: If available, returns an abbreviated name for the provided revision. Otherwise returns the revision unchanged. -
get_commit_from_rev: If available, returns the full commit of the provided revision. Otherwise returns an error.
-
Example:
makeSslCertificate
Self sign certificates
by using the openssl req command,
then using openssl x509
to print out the certificate
in text form.
Types:
- makeSslCertificate (
function { ... } -> package):- days (
ints.positive): Optional. Ammount of days to certify the certificate for. Defaults to30. - keyType (
str): Optional. Defines the key type for the certificate (option used for the-newkeyoption on thereqcommand). It uses the formrsa:nbits, wherenbitsis the number of bits. Defaults torsa:4096. - name (
str): Custom name to assign to the build step, be creative, it helps in debugging. - options (
listOf (listOf str)): Contains a list of options to create the certificate with your own needs. Here you can use the same options used withopenssl req.
- days (
Example:
pathShebangs
Replace common shebangs for their Nix equivalent.
For example:
/bin/env xxx->/nix/store/..-name/bin/xxx/usr/bin/env xxx->/nix/store/..-name/bin/xxx/path/to/my/xxx->/nix/store/..-name/bin/xxx
Types:
- pathShebangs (
package): When sourced, it exports a Bash function calledpatch_shebangsinto the evaluation context. This function receives one or more files or directories as arguments and replace shebangs of the executable files in-place. Note that only shebangs that resolve to executables in the"${PATH}"(a.k.a.searchPaths.bin) will be taken into account.
Example:
sublist
Return a sublist of a given list using a starting and an ending index.
Types:
- sublist (
function list, ints.positive, ints.positive -> listOf Any):- (
list): List to get sublist from. - (
ints.positive): Starting list index. - (
ints.positive): Ending list index.
- (
Example: