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() {
58
58
exit 1
59
59
}
60
60
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
+
61
74
# # Main ##
62
75
63
76
while [[ $# -gt 0 ]]; do
@@ -81,7 +94,8 @@ while [[ $# -gt 0 ]]; do
81
94
shift
82
95
;;
83
96
--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 " ) " )
85
99
shift
86
100
;;
87
101
--special-arg)
You can’t perform that action at this time.
0 commit comments