-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
nixos/nginx: add cgit sub-service #109915
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
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.
Ideally the module should also have a nixos integration test.
configText = mkOption { | ||
default = ""; | ||
example = '' | ||
virtual-root=/ | ||
source-filter=''${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py | ||
about-filter=''${pkgs.cgit}/lib/cgit/filters/about-formatting.sh | ||
cache-size=1000 | ||
scan-path=/srv/git | ||
''; | ||
type = types.lines; | ||
description = '' | ||
Verbatim contents of the cgit runtime configuration file. Documentation | ||
(with cgitrc example file) is available in "man cgitrc". Or online: | ||
http://git.zx2c4.com/cgit/tree/cgitrc.5.txt | ||
''; | ||
}; |
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.
This way of configuring services is discouraged (see RFC0042). Since the config file has an INI-like format, it should be easy to generate it from Nix expressions. See also https://nixos.org/manual/nixos/stable/index.html#sec-freeform-modules
virtualHost = mkOption { | ||
default = "_"; | ||
type = types.str; | ||
description = '' | ||
VirtualHost to serve cgit on. Default is catch-all. | ||
''; | ||
}; |
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.
This doesn't scale well. What if a user wants to run multiple cGit instances?
environment.systemPackages = [ pkgs.cgit ]; | ||
|
||
services.fcgiwrap.enable = true; | ||
services.fcgiwrap.socketAddress = "/run/fcgiwrap.cgit.socket"; |
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.
services.fcgiwrap.socketAddress = "/run/fcgiwrap.cgit.socket"; |
Leave this at the default or at least use mkDefault
.
fastcgi_param SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi; | ||
fastcgi_param QUERY_STRING $args; | ||
fastcgi_param HTTP_HOST $server_name; | ||
fastcgi_pass unix:/run/fcgiwrap.cgit.socket; |
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.
Use the system default here.
fastcgi_pass unix:/run/fcgiwrap.cgit.socket; | |
fastcgi_pass unix:${config.services.fcgiwrap.socketAddress} |
locations."${cfg.location}" = { | ||
extraConfig = | ||
'' | ||
gzip off; |
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.
Why do you turn off gzip?
3317ca0
to
3d348c8
Compare
Thanks for this interesting feedback, i'll try to improve it. (and also fix the error with my git rebase). |
3d348c8
to
90922d4
Compare
I had a go at this myself, since I'm also using cgit. Here you can see the result: |
thank you, it's great, I started to watch Freeform submodule but here is a clear example with a test. |
That's actually not a test (I guess |
it seems to me that the new cgit.nix is a very good base to add to nixpkgs modules. If test needed (or not) i'll play a bit with it. |
in fact there are still some bug to be fixed, I continue to test and I do a summary later. |
The problem is that some settings could be multiple (section, repo.url, repo.path, repo.desc, repo.owner...). |
@afix-space I've updated the Gist which should reflect the required changes. For anything that needs to be ordered you can use the |
Nice changes, well done ! |
@hmenke I think a fair bit of the
See https://github.com/NixOS/nixpkgs/blob/ba5f50a76c352df9bbe8ca5771a20d014c10aa99/pkgs/pkgs-lib/formats.nix#L59..L84 for details. |
I think that's why it allows more types than necessary. |
I had to make a new pull request. (I broke my branche, it's messy to repair) |
@aanderse Unfortunately, none of the existing settings formats can be used here, because the |
Duplicate of #110270 |
Motivation for this change
Similarly to module lighttpd/cgit or nginx/gitweb, add cgit sub-service to nginx
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)