Plain lib
lib._convertListToDrvs
Converts a list of strings or derivations into a list of derivations from pkgs.
Arguments:
pkgs: The package set to resolve string names to derivations.vals: A list of strings (attribute names) or derivations. Null elements are ignored.ignoreMissing(optional, default:false): If true, missing derivations are skipped with a warning.
Returns:
- A list of derivations, resolving strings via
pkgs.
@example
lib._convertListToDrvs {
pkgs = pkgs;
vals = [ pkgs.human-mj-description "human-mj-description" ];
}
Type: { pkgs: AttrSet, vals: [String | Derivation], ignoreMissing?: Bool } -> [Derivation]
lib.convertListToDrvsStrict
Converts a list of strings or derivations into a list of derivations from pkgs, throwing an error if any string is not found.
Arguments:
pkgs: The package set to resolve string names to derivations.vals: A list of strings (attribute names) or derivations.
Returns:
- A list of derivations, resolving strings via
pkgs. Throws an error if a string is missing.
@example
lib.convertListToDrvsStrict pkgs [ pkgs.human-mj-description "human-mj-description" ]
lib.convertListToDrvsStrict pkgs [ "mc-hrp4" ]
Type: pkgs: AttrSet -> vals: [String | Derivation] -> [Derivation]
lib.convertListToDrvs
Converts a list of strings or derivations into a list of derivations from pkgs, skipping missing strings with a warning.
Arguments:
pkgs: The package set to resolve string names to derivations.vals: A list of strings (attribute names) or derivations.
Returns:
- A list of derivations, resolving strings via
pkgs. Missing strings are skipped with a warning.
@example
lib.convertListToDrvs pkgs [ pkgs.human-mj-description "human-mj-description" ]
lib.convertListToDrvs pkgs [ "mc-hrp4" ]
Type: pkgs: AttrSet -> vals: [String | Derivation] -> [Derivation]
lib.drvsFromPassthruField
Returns a list of derivations from a passthru attribute (which may be a derivation, a string, or a list of both) in a list of derivations.
Arguments:
pkgs: The package set to resolve string names to derivations.getField: A function that extracts the attribute from a derivation (e.g.,drv: drv.passthru.robot.module).drvs: A list of derivations containing the field.
Returns:
- A flat list of derivations extracted from the passthru field of each input derivation.
@example
lib.drvsFromPassthruField pkgs (drv: drv.passthru.robot.module) [
pkgs.human-mj-description
pkgs.g1-mj-description
]
Type: pkgs: AttrSet -> getField: (Derivation -> a) -> drvs: [Derivation] -> [Derivation]
lib.mujocoRobotsFromRobotModules
Gathers MuJoCo robot derivations from a list of robot modules.
Each robot module should provide passthru.mujocoRobots = [ "robot-mj-description" ].
@param pkgs Set. The package set to look up derivations. @param robots List of derivations. The robot modules. @return List of derivations. The MuJoCo robot derivations from the modules.
lib.replaceMcMujocoInApps
Replaces the mc-mujoco derivation in the apps list with a version overridden with the given MuJoCo robots.
If an app in the list is pkgs.mc-mujoco, it is replaced with an overridden version using the provided mujocoRobots.
Other apps are left unchanged.
@param apps List of derivations. The applications list. @param pkgs Set. The package set containing mc-mujoco and mc-mujoco-robots. @param mujocoRobots List of derivations. The MuJoCo robots to use in the override. @return List of derivations. The updated applications list.
lib.mkControllerSuperbuild
mkControllerSuperbuild
Constructs a superbuild attribute set for a given controller derivation.
Arguments:
pkgs: The Nixpkgs package set.controller-drv: The controller derivation (attribute set) to wrap.extends(default:[]): List of superbuilds to extend from.with-suggested(default:true): Whether to include suggested apps/robots.
Returns:
- extends: The list of extended superbuilds.
- runtime: Runtime environment (controllers, plugins, observers).
- apps: (optional) Suggested apps, if with-suggested is true.
- robots: (optional) Suggested robots, if with-suggested is true.
- devel: Development environment (controllers).
- enabled: The enabled controller name, if set.
Example
let
myControllerDrv = pkgs.stdenv.mkDerivation {
name = "my-controller";
# ... build instructions ...
passthru = {
plugins = [ footsteps-planner-plugin mc-joystick-plugin ];
observers = [ some-observer ];
controller = {
Enabled = "ismpc_walking";
MainRobot = "JVRC1";
};
suggests = {
robots = [ "mc-hrp4" "mc-hrp2" ];
apps = [ "mc-mujoco" ];
};
};
};
in
mkControllerSuperbuild pkgs myControllerDrv { with-suggested = true; }