File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,19 @@ abort() {
5858 exit 1
5959}
6060
61+ # TODO: Is there a better name for this?
62+ fixDiskSizeFormat () {
63+ # If the arg is an int, pass it back unchanged:
64+ if [[ " $1 " =~ ^[0-9][0-9]* $ ]]; then
65+ echo " $1 "
66+ return
67+ fi
68+
69+ # If the arg is _not_ an int, we'll assume it's a string.
70+ # Therefore, we'll make sure it's wrapped in quotes, so its eval'd as a string by Nix:
71+ echo " \" $1 \" "
72+ }
73+
6174# # Main ##
6275
6376while [[ $# -gt 0 ]]; do
@@ -81,7 +94,8 @@ while [[ $# -gt 0 ]]; do
8194 shift
8295 ;;
8396 --disk-size)
84- nix_build_args+=(" --argstr" " diskSize" " $2 " )
97+ # Note: make sure integers are not incorrectly interpreted as strings by Nix:
98+ nix_build_args+=(" --arg" " diskSize" " $( fixDiskSizeFormat " $2 " ) " )
8599 shift
86100 ;;
87101 --special-arg)
You can’t perform that action at this time.
0 commit comments