mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
Add build command
This commit is contained in:
parent
b4818078f3
commit
4122727e1b
1 changed files with 27 additions and 9 deletions
|
|
@ -13,6 +13,25 @@ function errorEcho() {
|
||||||
>&2 echo $@
|
>&2 echo $@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setupPasstroughOpts() {
|
||||||
|
if [[ -v VERBOSE ]]; then
|
||||||
|
PASSTHROUGH_OPTS+=(--show-trace)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n "$CONFIG_FILE" ]]; then
|
||||||
|
PASSTHROUGH_OPTS+=(--argstr config "$(realpath "$CONFIG_FILE")")
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function doBuild() {
|
||||||
|
echo "Building activation package..."
|
||||||
|
nix build \
|
||||||
|
--file "<nix-on-droid/modules>" \
|
||||||
|
${PASSTHROUGH_OPTS[*]} \
|
||||||
|
activationPackage
|
||||||
|
}
|
||||||
|
|
||||||
function doGenerations() {
|
function doGenerations() {
|
||||||
nix-env --profile $PROFILE_DIRECTORY --list-generations
|
nix-env --profile $PROFILE_DIRECTORY --list-generations
|
||||||
}
|
}
|
||||||
|
|
@ -45,6 +64,8 @@ function doHelp() {
|
||||||
echo
|
echo
|
||||||
echo " rollback Rollback and activate configuration"
|
echo " rollback Rollback and activate configuration"
|
||||||
echo
|
echo
|
||||||
|
echo " build Build configuration"
|
||||||
|
echo
|
||||||
echo " switch Build and activate configuration"
|
echo " switch Build and activate configuration"
|
||||||
echo
|
echo
|
||||||
echo " switch-generation NUM"
|
echo " switch-generation NUM"
|
||||||
|
|
@ -52,14 +73,6 @@ function doHelp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSwitch() {
|
function doSwitch() {
|
||||||
if [[ -v VERBOSE ]]; then
|
|
||||||
PASSTHROUGH_OPTS+=(--show-trace)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$CONFIG_FILE" ]]; then
|
|
||||||
PASSTHROUGH_OPTS+=(--argstr config "$(realpath "$CONFIG_FILE")")
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Building activation package..."
|
echo "Building activation package..."
|
||||||
nix build \
|
nix build \
|
||||||
--no-link \
|
--no-link \
|
||||||
|
|
@ -100,7 +113,7 @@ while [[ $# -gt 0 ]]; do
|
||||||
opt="$1"
|
opt="$1"
|
||||||
shift
|
shift
|
||||||
case $opt in
|
case $opt in
|
||||||
generations|help|rollback|switch|switch-generation)
|
build|generations|help|rollback|switch|switch-generation)
|
||||||
COMMAND="$opt"
|
COMMAND="$opt"
|
||||||
;;
|
;;
|
||||||
-f|--file)
|
-f|--file)
|
||||||
|
|
@ -147,12 +160,17 @@ while [[ $# -gt 0 ]]; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
setupPasstroughOpts
|
||||||
|
|
||||||
if [[ -z $COMMAND ]]; then
|
if [[ -z $COMMAND ]]; then
|
||||||
doHelp >&2
|
doHelp >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $COMMAND in
|
case $COMMAND in
|
||||||
|
build)
|
||||||
|
doBuild
|
||||||
|
;;
|
||||||
generations)
|
generations)
|
||||||
doGenerations
|
doGenerations
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue