From 43dade238f39fc3edb6c6be6d318e4f7f990f971 Mon Sep 17 00:00:00 2001 From: Lily Ballard Date: Sat, 20 Jul 2019 19:53:19 -0700 Subject: installShellFiles: init (#65211) This is a new package that provides a shell hook to make it easy to declare manpages and shell completions in a manner that doesn't require remembering where to actually install them. Basic usage looks like { stdenv, installShellFiles, ... }: stdenv.mkDerivation { # ... nativeBuildInputs = [ installShellFiles ]; postInstall = '' installManPage doc/foobar.1 installShellCompletion --bash share/completions/foobar.bash installShellCompletion --fish share/completions/foobar.fish installShellCompletion --zsh share/completions/_foobar ''; # ... } See source comments for more details on the functions. --- doc/stdenv.xml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'doc') diff --git a/doc/stdenv.xml b/doc/stdenv.xml index fe592965656..15a13ba49e8 100644 --- a/doc/stdenv.xml +++ b/doc/stdenv.xml @@ -2714,6 +2714,49 @@ nativeBuildInputs = [ breakpointHook ]; + + + installShellFiles + + + + This hook helps with installing manpages and shell completion files. It + exposes 2 shell functions installManPage and + installShellCompletion that can be used from your + postInstall hook. + + + The installManPage function takes one or more paths + to manpages to install. The manpages must have a section suffix, and may + optionally be compressed (with .gz suffix). This + function will place them into the correct directory. + + + The installShellCompletion function takes one or more + paths to shell completion files. By default it will autodetect the shell + type from the completion file extension, but you may also specify it by + passing one of --bash, --fish, or + --zsh. These flags apply to all paths listed after + them (up until another shell flag is given). Each path may also have a + custom installation name provided by providing a flag --name + NAME before the path. If this flag is not provided, zsh + completions will be renamed automatically such that + foobar.zsh becomes _foobar. + +nativeBuildInputs = [ installShellFiles ]; +postInstall = '' + installManPage doc/foobar.1 doc/barfoo.3 + # explicit behavior + installShellCompletion --bash --name foobar.bash share/completions.bash + installShellCompletion --fish --name foobar.fish share/completions.fish + installShellCompletion --zsh --name _foobar share/completions.zsh + # implicit behavior + installShellCompletion share/completions/foobar.{bash,fish,zsh} +''; + + + + libiconv, libintl -- cgit v1.2.3 From 18f7f19ce2adc6d61d73cf993cec5de89869d86a Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Fri, 30 Aug 2019 15:46:38 +0200 Subject: ociTools: init --- doc/functions.xml | 1 + doc/functions/ocitools.xml | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 doc/functions/ocitools.xml (limited to 'doc') diff --git a/doc/functions.xml b/doc/functions.xml index 3b60f46d81d..96bd95958ea 100644 --- a/doc/functions.xml +++ b/doc/functions.xml @@ -20,4 +20,5 @@ + diff --git a/doc/functions/ocitools.xml b/doc/functions/ocitools.xml new file mode 100644 index 00000000000..4500c41a34a --- /dev/null +++ b/doc/functions/ocitools.xml @@ -0,0 +1,76 @@ +
+ pkgs.ociTools + + + pkgs.ociTools is a set of functions for creating + containers according to the + OCI + container specification v1.0.0. Beyond that it makes no assumptions + about the container runner you choose to use to run the created container. + + +
+ buildContainer + + + This function creates a simple OCI container that runs a single command + inside of it. An OCI container consists of a config.json + and a rootfs directory.The nix store of the container will contain all + referenced dependencies of the given command. + + + + The parameters of buildContainer with an example value + are described below: + + + + Build Container + +buildContainer { + cmd = with pkgs; writeScript "run.sh" '' + #!${bash}/bin/bash + ${coreutils}/bin/exec ${bash}/bin/bash + ''; + + mounts = { + "/data" = { + type = "none"; + source = "/var/lib/mydata"; + options = [ "bind" ]; + }; + }; + + readonly = false; +} + + + + + + cmd specifies the program to run inside the container. + This is the only required argument for buildContainer. + All referenced packages inside the derivation will be made available + inside the container + + + + + mounts specifies additional mount points chosen by the + user. By default only a minimal set of necessary filesystems are mounted + into the container (e.g procfs, cgroupfs) + + + + + readonly makes the container's rootfs read-only if it is set to true. + The default value is false false. + + + + +
+
-- cgit v1.2.3