piwik & piwik service: init at 3.0.4#26073
Conversation
|
@florianjacob, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @joachifm and @offlinehacker to be potential reviewers. |
8f86def to
d309b61
Compare
nixos/modules/misc/ids.nix
Outdated
There was a problem hiding this comment.
Why is a static uid required?
There was a problem hiding this comment.
My initial thought was so that the whole dataDir folder /var/lib/piwik can be easily restored from a backup, e.g. after a failure that needed a reinstall or on another machine.
In the meantime I learned that actually only a single file, /var/lib/piwik/config/config.ini.php needs to be backed up. It's probably easy enough to fix uid+gid for a single file manually on restores, so I guess it's not that required anymore. Nothing in the code depends on it, I could simply remove the static assignment again.
This is my first nixpkg package, could you tell me more about in which cases and for what purposes it's considered good pratice to use static ids, and in which it isn't?
There was a problem hiding this comment.
The most clear-cut use for static uids is if you need to refer to a user before the user/uid mapping is established. Otherwise, you need to make a judgement about the kind of data the daemon generates, whether you'd transfer the data between hosts, whether ownership can be easily fixed up, what the privacy or security implications would be if the data ended up being owned (however transiently) by another user etc.
Relying on static uids to maintain ownership invariants is fragile imo (it won't help if you transfer data to a non-NixOS host, for example). Better to have code that enforces invariants you care about directly.
Now, I don't mean to say you should overthink this but there should be a reason for doing it :)
There was a problem hiding this comment.
Thanks alot for that explanation, that was very helpful. :)
I decided to remove the static ids and added a small chown+chmod script in the systemd unit that is executed as root and enforces the right ownership and permissions on startup instead. I figured that's much more beneficial to what I wanted to achieve, keeping things private while allowing an occasional but easy restore/move.
There was a problem hiding this comment.
Sounds good to me. If it turns out that a static uid makes more sense, it can always be added later (the other way 'round is a little harder).
|
@joachifm thanks for taking a look! 😄 |
258b4c1 to
3dd9633
Compare
joachifm
left a comment
There was a problem hiding this comment.
Added some nitpicks for you to consider. None of them blockers.
There was a problem hiding this comment.
I think users.extraGroups.${user} = {} would work as well.
There was a problem hiding this comment.
Much more elegant. 😃
There was a problem hiding this comment.
Note that "${foo}" could be simplified to foo.
There was a problem hiding this comment.
Group is strictly redundant, it defaults to the primary group of User.
There was a problem hiding this comment.
Please consider disabling problematic phases instead of listing phases; this is a known source of bugs.
There was a problem hiding this comment.
Could just throw this out completely, did learn that all default phases don't do anything like the buildPhase doesn't do anything if there is no Makefile.
There was a problem hiding this comment.
Can go innativeBuildInputs.
There was a problem hiding this comment.
Consider postPatch; at least in general its nice to allow applying arbitrary patches via override. Specifying a custom patch phase prevents that.
There was a problem hiding this comment.
Nit: examples for booleans are usually skipped, it's self-evident.
There was a problem hiding this comment.
Note that long-form descriptions may not render very well. You can generate the nixos manual to check whether it'll look okay. You can farm out longer documentation fragments to the manual.
There was a problem hiding this comment.
You are right, it renders quite bad.
So it would be ok to include a new manual section like II.Configuration > 22. piwik for that longer part? I was struggeling to find a good place for this, but now I see this long description isn't one.
There was a problem hiding this comment.
Note that this will cause install hooks to be skipped (you can run e..g, the post phase hook manually with runHook postInstall).
There was a problem hiding this comment.
I understand. I added runHook call for preInstall / postInstall as first / last commands of my installPhase, mirroring the default implementation I found in pkgs/stdenv/generic/setup.sh. From that file I assume there's no better way to overwrite / have a custom installPhase without having to call the hooks by hand, right?
There was a problem hiding this comment.
Pretty much. At some point I think it's possible hooks may become implicit, making this a bit more natural.
There was a problem hiding this comment.
If you wish, you could add yourself to the list of maintainers.
There was a problem hiding this comment.
I thought you had to be part of the NixOS github organization to be a maintainer. 😅
There was a problem hiding this comment.
Not at all. It basically means you care about the package, lets other's know to ping you if there are questions or whatever.
I can feel the packaging quality is increasing…✨ 😄 |
|
I don't have much more to add, so let me know when you're ready to integrate. |
There was a problem hiding this comment.
It was actually intentional, as it is a web application for web analytics, but I admit it sounds really weird in english, adds nothing much and probably irritates the reader more than clarifies stuff. 😆 Thanks!
6b5fd6d to
711507a
Compare
|
@joachifm / @Alphor I've aded a NixOS manual chapter for piwik now, and I think it's good not to try to cram it all into the description. 😄 If you don't have any other suggestions for the manual, I'd be ready to integrate now. The manual also contains a paragraph on this sendmail issue, I'd remove it later if the issue is resolved, but it seems to be nothing trivial: #26611 @Alphor can I get back on your offer to test other stuff? In case you have some kind of |
|
@florianjacob |
|
@Alphor yes, an MTA would be enough, it just needs to provide the |
711507a to
55844c8
Compare
|
Thank you |
Motivation for this change
Piwik is an open analytics application. Resolves #25266.
Things done
(nix.useSandbox on NixOS,
or option
build-use-sandboxinnix.confon non-NixOS)
nix-shell -p nox --run "nox-review wip"./result/bin/)