-
-
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
feat: Add package list metadata to Terraform build output via nvd #460
base: main
Are you sure you want to change the base?
Conversation
@@ -39,5 +39,20 @@ else | |||
# inject `special_args` into nixos config's `specialArgs` | |||
# shellcheck disable=SC2086 | |||
out=$(nix build --no-link --json ${options} --expr "${nix_expr}" "${config_attribute}") | |||
output_path=$(echo "$out" | jq -r '.[].outputs.out') | |||
packages_json=$(nvd list --selected --root "$output_path" | awk ' |
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.
Maybe add some conditional if nvd is not present?
if command -v nvd; then
fi
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.
Currently we don't enable pipefail
but I think we should
@@ -1,6 +1,7 @@ | |||
resource "null_resource" "nixos-rebuild" { | |||
triggers = { | |||
store_path = var.nixos_system | |||
packages_list = var.nixos_system_packages |
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 am not quite getting, why we need this trigger? Is the store_path not enough?
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.
If I'm not mistaken, you need it for package_list
diff to be displayed during the plan, though I could be wrong.
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 see. Actually the terraform option description is a bit misleading in this case, which was also the initial source of my confusion. Could you change that and also add to nixos-rebuild.md
how to wire things up i.e. use nix-build output and feed it into the nixos-rebuild module?
Changes
This PR enhances the Nix build script to:
nvd list
on the derivation output to collect installed packages.out
(build path) andpackages
(serialized JSON array).Example Output:
Notes
nvd
installed, but if not returns an empty list