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
nginx: formating the config file #56280
Conversation
@GrahamcOfBorg test nginx nginx-sso |
Thanks! |
@Izorkin Thanks, sometimes it's nice to have a more readable config. Most often it doesn't matter... But when you need it it's very handy. |
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.
Review late, but please keep the comments in mind for the future.
@@ -44,7 +44,25 @@ let | |||
} | |||
'')); | |||
|
|||
configFile = pkgs.writeText "nginx.conf" '' | |||
awkFormat = pkgs.writeText "awkFormat-nginx.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.
I usually prefer builtins.toFile
when the file is constant, because then there's one less derivation to build.
phases = [ "installPhase" ]; | ||
installPhase = '' | ||
mkdir $out | ||
awk -f ${awkFormat} ${pre-configFile} | sed '/^\s*$/d' > $out/nginx.conf |
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.
There's pkgs.runCommand
when you only need to run a command.
And you can output the file directly to $out
, no need to make it a folder.
Motivation for this change
Formating the config file with awk to readable format.
Used this script - https://github.com/nixcloud/nixcloud-webservices/blob/master/modules/web/webserver/lib/nginx_check_config.nix
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)