mirror of
https://github.com/foo-dogsquared/nix-module-wrapper-manager-fds.git
synced 2025-02-19 06:19:03 +00:00
lib: add nixdoc docstrings
This commit is contained in:
parent
f48ff49635
commit
fc4866826c
78
lib/env.nix
78
lib/env.nix
@ -1,11 +1,85 @@
|
|||||||
rec {
|
rec {
|
||||||
/*
|
/**
|
||||||
Given the attrset for evaluating a wrapper-manager module, return a
|
Given the attrset for evaluating a wrapper-manager module, return a
|
||||||
derivation containing the wrapper.
|
derivation containing the wrapper.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
|
||||||
|
It has the same arguments as
|
||||||
|
[`wrapperManagerLib.env.eval`](#function-library-wrapperManagerLib.env.eval).
|
||||||
|
|
||||||
|
# Type
|
||||||
|
|
||||||
|
```
|
||||||
|
build :: Attr -> Derivation
|
||||||
|
```
|
||||||
|
|
||||||
|
# Example
|
||||||
|
|
||||||
|
```
|
||||||
|
build {
|
||||||
|
pkgs = import <nixpkgs> { };
|
||||||
|
modules = [
|
||||||
|
./wrapper-manager-config.nix
|
||||||
|
./modules/wrapper-manager
|
||||||
|
];
|
||||||
|
}
|
||||||
|
=>
|
||||||
|
<drv>
|
||||||
|
```
|
||||||
*/
|
*/
|
||||||
build = args: (eval args).config.build.toplevel;
|
build = args: (eval args).config.build.toplevel;
|
||||||
|
|
||||||
# Evaluate a wrapper-manager configuration.
|
/**
|
||||||
|
Evaluate a wrapper-manager configuration.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
|
||||||
|
Its argument only expects a sole attribute set with the following
|
||||||
|
attributes:
|
||||||
|
|
||||||
|
pkgs
|
||||||
|
: A nixpkgs instance.
|
||||||
|
|
||||||
|
lib
|
||||||
|
: The nixpkgs library subset. Defaults to `pkgs.lib` from the given nixpkgs
|
||||||
|
instance.
|
||||||
|
|
||||||
|
modules
|
||||||
|
: A list of additional wrapper-manager modules to be imported (typically
|
||||||
|
the wrapper-manager configuration and additional modules) for the final
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
specialArgs
|
||||||
|
: An additional set of module arguments that can be used in `imports`.
|
||||||
|
|
||||||
|
# Type
|
||||||
|
|
||||||
|
```
|
||||||
|
eval :: Attr -> Attr
|
||||||
|
```
|
||||||
|
|
||||||
|
# Example
|
||||||
|
|
||||||
|
```
|
||||||
|
eval {
|
||||||
|
pkgs = import <nixpkgs> { };
|
||||||
|
modules = [
|
||||||
|
./wrapper-manager-config.nix
|
||||||
|
./modules/wrapper-manager
|
||||||
|
];
|
||||||
|
}
|
||||||
|
=>
|
||||||
|
{
|
||||||
|
_module = { ... };
|
||||||
|
_type = "configuration";
|
||||||
|
class = null;
|
||||||
|
config = { ... };
|
||||||
|
options = { ... };
|
||||||
|
extendModules = <func>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
*/
|
||||||
eval =
|
eval =
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
|
@ -11,10 +11,55 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
/*
|
/**
|
||||||
Make a wrapper-manager wrapper config containing a sub-wrapper that wraps
|
Make a wrapper-manager wrapper config containing a sub-wrapper that wraps
|
||||||
another program. Several examples of this includes sudo, Bubblewrap, and
|
another program. Several examples of this includes sudo, Bubblewrap, and
|
||||||
Gamescope.
|
Gamescope.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
|
||||||
|
Its arguments is a sole attribute set with the following expected
|
||||||
|
attributes:
|
||||||
|
|
||||||
|
arg0
|
||||||
|
: Similar to `wrappers.<name>.arg0` from wrapper-manager module, it is a
|
||||||
|
store path containing an executable used as the main program of the wrapper.
|
||||||
|
|
||||||
|
under
|
||||||
|
: Similar to `arg0` but for the wraparound (e.g., sudo, doas, Bubblewrap).
|
||||||
|
|
||||||
|
underFlags
|
||||||
|
: Arguments of the wraparound. Defaults to an empty list.
|
||||||
|
|
||||||
|
underSeparator
|
||||||
|
: An optional string acting as the separator between the wraparound's
|
||||||
|
arguments and the arg0's arguments.
|
||||||
|
|
||||||
|
Note that the argument attrset can contain any attribute. The attrset is
|
||||||
|
then separated as a module and an additional module using the above
|
||||||
|
attributes.
|
||||||
|
|
||||||
|
# Type
|
||||||
|
|
||||||
|
```
|
||||||
|
makeWraparound :: Attr -> Module
|
||||||
|
```
|
||||||
|
|
||||||
|
# Example
|
||||||
|
|
||||||
|
```
|
||||||
|
makeWraparound {
|
||||||
|
arg0 = lib.getExe' pkgs.hello "hello";
|
||||||
|
appendArgs = [ "--traditional" ];
|
||||||
|
under = lib.getExe' pkgs.sudo "sudo";
|
||||||
|
underFlags = [ "-u" "admin" ];
|
||||||
|
}
|
||||||
|
=>
|
||||||
|
{
|
||||||
|
_type = "merge";
|
||||||
|
contents = [ ... ];
|
||||||
|
}
|
||||||
|
```
|
||||||
*/
|
*/
|
||||||
makeWraparound =
|
makeWraparound =
|
||||||
{
|
{
|
||||||
|
@ -5,27 +5,115 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
/*
|
/**
|
||||||
Given a list of derivations, return a list of the store path with the `bin`
|
Given a list of derivations, return a list of the store path with the `bin`
|
||||||
output (or at least with "/bin" in each of the paths).
|
output (or at least with "/bin" in each of the paths).
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
|
||||||
|
drvs
|
||||||
|
: A list of derivations.
|
||||||
|
|
||||||
|
# Type
|
||||||
|
|
||||||
|
```
|
||||||
|
getBin :: [ Derivation ] -> [ Path ]
|
||||||
|
```
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
getBin (with pkgs; [ hello coreutils ])
|
||||||
|
=>
|
||||||
|
[
|
||||||
|
"/nix/store/HASH-hello/bin"
|
||||||
|
"/nix/store/HASH-coreutils/bin"
|
||||||
|
]
|
||||||
|
```
|
||||||
*/
|
*/
|
||||||
getBin = drvs: builtins.map (v: lib.getBin v) drvs;
|
getBin = drvs: builtins.map (v: lib.getBin v) drvs;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Given a list of derivations, return a list of the store paths with the
|
Given a list of derivations, return a list of the store paths with the
|
||||||
`libexec` appended.
|
`libexec` appended.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
|
||||||
|
drvs
|
||||||
|
: A list of derivations.
|
||||||
|
|
||||||
|
# Type
|
||||||
|
|
||||||
|
```
|
||||||
|
getLibexec :: [ Derivation ] -> [ Path ]
|
||||||
|
```
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
getLibexec (with pkgs; [ hello coreutils ])
|
||||||
|
=>
|
||||||
|
[
|
||||||
|
"/nix/store/HASH-hello/libexec"
|
||||||
|
"/nix/store/HASH-coreutils/libexec"
|
||||||
|
]
|
||||||
|
```
|
||||||
*/
|
*/
|
||||||
getLibexec = drvs: builtins.map (v: "${v}/libexec") drvs;
|
getLibexec = drvs: builtins.map (v: "${v}/libexec") drvs;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Given a list of derivations, return a list of the store paths appended with
|
Given a list of derivations, return a list of the store paths appended with
|
||||||
`/etc/xdg` suitable as part of the XDG_CONFIG_DIRS environment variable.
|
`/etc/xdg` suitable as part of the XDG_CONFIG_DIRS environment variable.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
|
||||||
|
drvs
|
||||||
|
: A list of derivations.
|
||||||
|
|
||||||
|
# Type
|
||||||
|
|
||||||
|
```
|
||||||
|
getXdgConfigDirs :: [ Derivation ] -> [ Path ]
|
||||||
|
```
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
getXdgConfigDirs (with pkgs; [ hello coreutils ])
|
||||||
|
=>
|
||||||
|
[
|
||||||
|
"/nix/store/HASH-hello/etc/xdg"
|
||||||
|
"/nix/store/HASH-coreutils/etc/xdg"
|
||||||
|
]
|
||||||
|
```
|
||||||
*/
|
*/
|
||||||
getXdgConfigDirs = drvs: builtins.map (v: "${v}/etc/xdg") drvs;
|
getXdgConfigDirs = drvs: builtins.map (v: "${v}/etc/xdg") drvs;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Given a list of derivations, return a list of store paths appended with
|
Given a list of derivations, return a list of store paths appended with
|
||||||
`/share` suitable as part of the XDG_DATA_DIRS environment variable.
|
`/share` suitable as part of the XDG_DATA_DIRS environment variable.
|
||||||
|
|
||||||
|
# Arguments
|
||||||
|
|
||||||
|
drvs
|
||||||
|
: A list of derivations.
|
||||||
|
|
||||||
|
# Type
|
||||||
|
|
||||||
|
```
|
||||||
|
getXdgDataDirs :: [ Derivation ] -> [ Path ]
|
||||||
|
```
|
||||||
|
|
||||||
|
# Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
getXdgDataDirs (with pkgs; [ hello coreutils ])
|
||||||
|
=>
|
||||||
|
[
|
||||||
|
"/nix/store/HASH-hello/share"
|
||||||
|
"/nix/store/HASH-coreutils/share"
|
||||||
|
]
|
||||||
|
```
|
||||||
*/
|
*/
|
||||||
getXdgDataDirs = drvs: builtins.map (v: "${v}/share") drvs;
|
getXdgDataDirs = drvs: builtins.map (v: "${v}/share") drvs;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user