41 lines
779 B
Nix
41 lines
779 B
Nix
{
|
|
pkgs,
|
|
srcs,
|
|
...
|
|
}: let
|
|
inherit (srcs) cage;
|
|
cageWithEnvOption = pkgs.cage.overrideAttrs (final: prev: {
|
|
inherit (cage) src version;
|
|
});
|
|
in
|
|
pkgs.writeShellApplication {
|
|
name = "cage";
|
|
runtimeInputs = [cageWithEnvOption];
|
|
text = ''
|
|
args=()
|
|
output=
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
-o)
|
|
if [[ $# -ge 2 ]]; then
|
|
output="$2"
|
|
shift 2
|
|
else
|
|
args+=("$1")
|
|
shift
|
|
fi
|
|
;;
|
|
*)
|
|
args+=("$1")
|
|
shift
|
|
;;
|
|
esac
|
|
done
|
|
if [[ -n "$output" ]]; then
|
|
CAGE_OUTPUT_NAME="$output" cage "''${args[@]}"
|
|
else
|
|
cage "''${args[@]}"
|
|
fi
|
|
'';
|
|
}
|