-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
amazon-image: amazon-init script checks for nix expressions in userdata correctly #50763
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
Conversation
eabe459
to
e734b44
Compare
@matthewbauer Any thoughts on this ^^ |
This pull request has been mentioned on Nix community. There might be relevant details there: https://discourse.nixos.org/t/prs-ready-for-review-december/1711/11 |
echo "setting configuration from EC2 user data" | ||
cp "$userData" /etc/nixos/configuration.nix | ||
else | ||
echo "user data does not appear to be a Nix expression; ignoring" |
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.
You should probably change wording of this to indicate that the expression failed to evaluate.
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.
@veprbl thanks for the review. Would Failed to evaluate user data with nix-instantiate; ignoring
be a more suitable message.
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.
Ok, maybe, evaluate wasn't a right word here. How about "user data is not a valid Nix expression; ignoring"?
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.
@veprbl yeah thats wayy better.
cc @shlevy @copumpkin @edolstra as latest contributors to amazon-init.nix |
e734b44
to
6a52215
Compare
One other comment I have is that after your change, the else branch of
doesn't have a warning and, more importantly, it doesn't terminate with |
I don't see why this is necessary. The Nix expression will be checked eventually anyway by nixos-rebuild... |
6a52215
to
a6369f6
Compare
@veprbl Added the else clause as advised.
|
Well, I don't see why it matters whether it fails in amazon-init or in |
@edolstra mmmm, yeah. Closing then. |
A comment in amzon-init says that it will check for valid nix expressions but it do not do that. when lunching a nixos image from aws and typing whatever in the user-data field the amazon-init unit will copy that to configuration.nix and then it will fail when it run
nixos-rebuild switch
.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)