-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nix option in terraform and fix run-nixos-anywhere.sh #310
Conversation
The example shown in All-In-One seems wrong. |
terraform/nix-build/nix-build.sh
Outdated
if [[ -n ${file-} ]] && [[ -e ${file-} ]]; then | ||
out=$(nix build --no-link --json -f "$file" "$attribute") | ||
out=$(nix build --no-link --json $(echo "$nix_options") -f "$file" "$attribute") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shellcheck doesn't like this line.
Does jq handles the quoting here correctly?
If so, we can make shellcheck ignore this.
Fixed. I checked again with the orignal machine where I took this from. |
terraform/nix-build/main.tf
Outdated
@@ -1,8 +1,12 @@ | |||
locals { | |||
nix_options = var.nix_options == null ? "" : join(" ", [for k, v in var.nix_options : "--option ${k} ${v}"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we already give up on quoting here already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we not dump this as a json object here?
And than on the shell script side, we use jq to get the data back?
Than we can build up some array in bash instead with all quoting handled correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to json format and handled it on the shell side.
… into add-nix-option
5bc817e
to
bae3fe5
Compare
bae3fe5
to
43909cf
Compare
@Mic92 |
Thank you for the correction. |
On a separate matter, there is no |
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at aebe3d1 |
Probably just an oversight, we can add it there as well. |
The current terraform module does not accept nix options.
Therefore, it may not work properly when needing
--options pure-eval false
and so on.I add
nix_options
to the terraform module to address this issue.Also, I fixed an issue where
$tmpdir/keys
could not be created again when multipledisk_encryption_key_scripts
were specified inrun-nixos-anywhere.sh
, resulting in an error.