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
nixos/nginx: use nginxfmt and gixy #57979
Conversation
cp "$textPath" $out | ||
${pkgs.nginx-config-formatter}/bin/nginxfmt $out | ||
${pkgs.gnused}/bin/sed -i '/^$/d' $out | ||
${pkgs.gixy}/bin/gixy $out |
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.
How likely is gixy to break valid configuration?
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.
Should there be a opt-out flag?
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'm not sure how likely it is, but I'd argue that broken configurations should be fixed instead. Alternatively, writeNginxConfig
can be overridden. This might not be the most convenient solution, but it's also not too painful either. Basically a writeNginxConfig = self.writeText
would be sufficient. Anyway, if it's really desired, we can make it optional, or even pass arguments to gixy
(but I haven't needed that myself before).
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 could test on master and see how many people would complain about it.
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.
here to complain about it, breaks generic forward proxy configs
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.
Fails with:
error: attribute 'writeNginxConfig' missing
@GrahamcOfBorg test nginx |
Error work this code
result
character is added |
@Izorkin is it nginx or gixy that rejects the generated code? |
Nginx error:
|
Ok. So it is nginx itself. |
I can't upgrade to latest unstable because of this. I get no useful error messages:
|
@jb55 need full log. Example:
|
lzorkin: I need the full log too, I have no idea how to get that. I just reverted these commits for now. |
@jb55 use |
Motivation for this change
Currently nginx.conf gets formatted by an awk script. This PR replaces that script by
writeNginxConfig
which uses nginx-config-formatter to format, and gixy to analyze nginx configurations.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)