use nom-build if available

Nicer progress bars etc
This commit is contained in:
Jörg Thalheim 2024-03-11 15:57:23 +01:00 committed by Jörg Thalheim
parent a949edef70
commit fe064a6393
2 changed files with 18 additions and 2 deletions

10
disko
View file

@ -104,6 +104,14 @@ while [[ $# -gt 0 ]]; do
shift shift
done done
nixBuild() {
if command -v nom-build > /dev/null; then
nom-build "$@"
else
nix-build "$@"
fi
}
if ! { [[ $mode = "format" ]] || [[ $mode = "mount" ]] || [[ $mode = "disko" ]] || [[ $mode = "create" ]] || [[ $mode = "zap_create_mount" ]] ; }; then if ! { [[ $mode = "format" ]] || [[ $mode = "mount" ]] || [[ $mode = "disko" ]] || [[ $mode = "create" ]] || [[ $mode = "zap_create_mount" ]] ; }; then
abort "mode must be either format, mount or disko" abort "mode must be either format, mount or disko"
fi fi
@ -131,7 +139,7 @@ else
fi fi
# The "--impure" is still pure, as the path is within the nix store. # The "--impure" is still pure, as the path is within the nix store.
script=$(nix-build "${libexec_dir}"/cli.nix \ script=$(nixBuild "${libexec_dir}"/cli.nix \
--no-out-link \ --no-out-link \
--impure \ --impure \
--argstr mode "$mode" \ --argstr mode "$mode" \

View file

@ -139,6 +139,14 @@ cleanupMountPoint() {
rmdir "${mountPoint}" rmdir "${mountPoint}"
} }
nixBuild() {
if command -v nom-build > /dev/null; then
nom-build "$@"
else
nix-build "$@"
fi
}
main() { main() {
parseArgs "$@" parseArgs "$@"
@ -168,7 +176,7 @@ main() {
# shellcheck disable=SC2064 # shellcheck disable=SC2064
trap "cleanupMountPoint ${escapeMountPoint}" EXIT trap "cleanupMountPoint ${escapeMountPoint}" EXIT
outputs=$(nix-build "${libexec_dir}"/install-cli.nix \ outputs=$(nixBuild "${libexec_dir}"/install-cli.nix \
"${nix_args[@]}" \ "${nix_args[@]}" \
--no-out-link \ --no-out-link \
--impure \ --impure \