Skip to content

Commit

Permalink
use nom-build if available
Browse files Browse the repository at this point in the history
Nicer progress bars etc
  • Loading branch information
Mic92 committed Mar 11, 2024
1 parent a949ede commit fe064a6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion disko
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ while [[ $# -gt 0 ]]; do
shift
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
abort "mode must be either format, mount or disko"
fi
Expand Down Expand Up @@ -131,7 +139,7 @@ else
fi

# 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 \
--impure \
--argstr mode "$mode" \
Expand Down
10 changes: 9 additions & 1 deletion disko-install
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ cleanupMountPoint() {
rmdir "${mountPoint}"
}

nixBuild() {
if command -v nom-build > /dev/null; then
nom-build "$@"
else
nix-build "$@"
fi
}

main() {
parseArgs "$@"

Expand Down Expand Up @@ -168,7 +176,7 @@ main() {
# shellcheck disable=SC2064
trap "cleanupMountPoint ${escapeMountPoint}" EXIT

outputs=$(nix-build "${libexec_dir}"/install-cli.nix \
outputs=$(nixBuild "${libexec_dir}"/install-cli.nix \
"${nix_args[@]}" \
--no-out-link \
--impure \
Expand Down

0 comments on commit fe064a6

Please sign in to comment.