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/gitea: add cache option #108848
nixos/gitea: add cache option #108848
Conversation
012fb35
to
93b119a
Compare
748caf7
to
6af5560
Compare
6af5560
to
9851ad3
Compare
Personally I would either call this option
I think my preference is to keep it simple with Why do I care about the name? Aside from that everything looks great. And keep in mind the naming is just my opinion. Maybe you disagree, in which case you can feel free to ignore me 😄 Aside from that everything looks fine from a quick glance. ping @Ma27 for review - aren't you the maintainer of this module too? 🤔 If you're not you really should be 😄 |
I agree. Having more flexibility is probably a good idea. Another way might be to match Exposing these settings in services.gitea.cache = {
enable = true; # default
# Produces some thing like
# HOST="redis://:macaron@127.0.0.1:6379/0?pool_size=100&idle_timeout=180s"
"redis" = { # either "memory", "redis", or "memcache" with different options each
user = "macaron"; # optional
host = "127.0.0.1";
port = 6379; # optional
database = 0; # optional
poolSize = 100; # optional
idle_timeout = 180; # optional
};
}; # This would produce
# HOST="network=unix,addr=${redis.unixSocket},db=0,pool_size=100,idle_timeout=180"
services.gitea.cache = {
enable = true;
"redis".unixSocket = "/run/redis/redis.sock"; # mutually exclusive with (user, host, port)
} For now, I'd like to only allow "redis" for the adapter, since Memcache might require additional configuration. Users can still set this up manually using the settings. |
Or just |
|
That sounds reasonable 👍 |
I can leave a review later tonight or tomorrow @aanderse (this also applies to the other PRs where I got CCed :)).
Since most of the modules don't have a meta.maintainers field (I don't really know about this guideline for modules tbh) I usually consider the package maintainers as responsible for the module as well unless stated otherwise... But yeah, guess I'll add myself there as well later :) |
@GrahamcOfBorg test gitea |
9851ad3
to
fbe6013
Compare
Still needs some more automated tests. The redis cache already works fine using the unix socket. |
ab1fc1a
to
d0b756c
Compare
Co-authored-by: Henri Menke <henri@henrimenke.de>
b273b80
to
86aceb2
Compare
Should have sufficient test coverage now. Ready for review. |
@GrahamcOfBorg test gitea |
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 haven't tested it (I'm only using GItea with in-memory caching), but the module code looks totally sensible and there is a NixOS test. 👍
Uses gitea's default cache settings or the settings provided in the configuration.
Is it possible to declare a type in a way that it can be a submodule with contents either like
where the list elements are the possible submodules. |
I marked this as stale due to inactivity. → More info |
I think you want to construct a generic option which has a option for the cache type instead. |
This adds an option that sets up an in-memory cache.
Motivation for this change
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)