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
jellyfin 10.5.5 -> 10.6.0 #93654
jellyfin 10.5.5 -> 10.6.0 #93654
Conversation
Hi, Thanks for the contribution! Apparently, the homepage redirects to Appart from that, this looks good to me. |
I have also checked the nixos test ( |
Sure, let me update that! |
The release notes strongly suggest doing backups of the state directory in case of a rollback, which can't be done automatically from this new version. Is there something we should do to prevent some unwanted surprises for users of the jellyfin module? In my opinion, it's also something to keep in mind for the NixOS release notes, too |
I was going to suggest adding a blurb in the release notes that you should make a backup, etc, etc. |
Something like the above could possibly suffice for at least allowing the users to rollback if needed after upgrading to 10.6.0. Along with a by-line in the release notes for this package. |
I'm personally not a fan of doing the backups this way, it seems to me a bit orthogonal to the nixos way: not configurable, and done without mentioning it to the users. The only way for them to see that this backup is done is either by being aware of this PR, reading the source code before It also introduces a new directory under But, I might need a second opinion on this |
That is true, and I do agree.
If set to true then tar.gz up the dir and place it somewhere. Could model it off a similar option in gitea. But really it seems like folks are going to either need to read the release notes at some point or be aware of breaking changes. There's only so much we can do I think. Unless we can have some way to detect they're upgrading to 10.6.0 and backup their data dir + dump a message to stdout for them. |
Jellyfin 10.6.1 released a few hours ago, could you update the derivation? |
Reguarding the question of the module storage part, one approach that can be to do something like: serviceConfig = rec {
User = cfg.user;
Group = cfg.group;
StateDirectory = "jellyfin";
CacheDirectory = "jellyfin";
db_version = pkgs.lib.versions.majorMinor pkgs.jellyfin.version;
ExecStart = "${pkgs.jellyfin}/bin/jellyfin --datadir '/var/lib/${StateDirectory}/${db_version}' --cachedir '/var/cache/${CacheDirectory}'";
Restart = "on-failure";
}; This is the kind of approach that is used for postgresql. This is not perfect since after an upgrade you tend to have old state dir that dangle around forever. But if the main concern is about keeping old version of the data before a major upgrade, it kind of does the trick (considering that you never actually upgrade, but only create a fresh instance). |
That actually is a good idea. Wonderful, thank you. I'll make those modifications soon as I get the chance today. @lsix My only question is, does this mean setup will have to be done anew after every upgrade?
Yep definitely, should help some with the mem leaks this version can have. |
It overall looks good. From what I see:
(If you need help with point 2, reach out)
As it is, yes (for every « major » upgrade ; not for a minor, such as 10.6.0 -> 10.6.1). We might want to be a bit more clever about this, and maybe ass a |
All good points, a preStart step might be a good idea ya. As far as squashing git commits, things are somewhat inter leavened I believe. Package updates and module updates in the same commits. Guess the best way might be reverting/deleting the module updates in a new commit, squash, and then make a new commit with module updates ya? |
@lsix Already, redid the commits as per your suggestion. One for the package update.One for the module. For the module there's a... fairly gnarly shellscript in the PreStart stage of the service.
Thoughts? |
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.
Few remarks.
As mentioned by @minijackson this approach is not completely usual in the nixos ecosystem. Having this behavior governed by an option (jellyfin.versioned_statedir
or something else, I am terrible with finding good concise names) could be beneficial. In many systems, it would make sense to just use the service as it is currently, and rely on a generic backup system aside (I guess).
I do not really have a strong opinion on where this should go, so I’ll let @minijackson decide as module maintainer ^_^
Anyway @Church- thanks a lot for your contribution and work, sorry this takes so long.
cp -r /var/lib/${StateDirectory}/data /var/lib/${StateDirectory}/database/${db_version}/ | ||
exit 0 | ||
else | ||
versions=$(find /var/lib/${StateDirectory}/database/ -maxdepth 1 -mindepth 1 | sort -r) |
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.
Sort might not work as expected here:
echo -e "10.8\n10.9\n10.10"|sort -r
10.9
10.8
10.10
do | ||
if [ -d "$version" ]; then | ||
if find "$version" -mindepth 1 -print -quit 2>/dev/null | grep -q .; then; | ||
cp -r "$version" /var/lib/${StateDirectory}/database/${db_version} |
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.
If we have this sort of thing, I guess we might want a clean-up mechanism (or not, I really do not know). Maybe drop all but 2 most recent?
ExecPreStart = '' | ||
#!/bin/bash | ||
mkdir -p /var/lib/${StateDirectory}/database/${db_version} | ||
if [ "${db_version}" = "10.6.1" ]; then |
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.
maybe
if [ -d "/var/lib/${StateDirectory}/data" ]
would be more direct and also more generic (not version specific).
#!/bin/bash | ||
mkdir -p /var/lib/${StateDirectory}/database/${db_version} | ||
if [ "${db_version}" = "10.6.1" ]; then | ||
cp -r /var/lib/${StateDirectory}/data /var/lib/${StateDirectory}/database/${db_version}/ |
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 have not checked, but what happens to everything that does not fall into data
? (log
and so on)
Ultimately, I think it should be up for the user / sysadmin to decide how and if they want to backup the jellyfin state directory. One solution that could be nice is to do it the PostgreSQL way, and use the {
services.jellyfin.package = mkDefault (
if versionAtLeast config.system.stateVersion "20.09" then pkgs.jellyfin
else pkgs.jellyfin_10_5);
} That would mean we would also have to add the Sorry to ask you that again, but could you also update the version to the recently released 10.6.2? |
Given we want to waylay any possible db corruptions/rollback issues. Maybe defaulting to pkgs.jellyfin10_5 and having to opt in to pkgs.jellyfin without the dep rectifying above. |
Do you mean defaulting the I'm personally more fond of the "default to the old one only if But if you feel I'm missing something, feel free to tell! |
Hmm, okay. No I think you do have the right of it ya. I'll go with that implementation idea. |
Upgrade-wise this WFM, no related issues in the last weeks, beyond upgrading to 10.6.2 because of a 404. I also agree using stateVersion is the way to go. |
@lsix Finally pushed those changes, if you're happy with them then I think we're good to merge down. |
Thank you! Small nitpick: according to the CONTRIBUTING, I think your last commit should start with |
Just did a
|
package = mkDefault ( | ||
if versionAtLeast config.system.stateVersion "20.09" then pkgs.jellyfin | ||
else pkgs.jellyfin_10_5 | ||
); |
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.
package = mkDefault ( | |
if versionAtLeast config.system.stateVersion "20.09" then pkgs.jellyfin | |
else pkgs.jellyfin_10_5 | |
); | |
package = mkOption { | |
type = types.package; | |
example = literalExample "pkgs.jellyfin"; | |
description = '' | |
Jellyfin package to use. | |
''; | |
}; |
then you can add this to the configuration part:
services.jellyfin.package =
mkDefault (if versionAtLeast config.system.stateVersion "20.09" then pkgs.jellyfin
else pkgs.jellyfin_10_5);
and finally, you can replace pkgs.jellyfin
by cfg.package
in the ExecStart
line of the configuration part.
Ugh, dumb mistakes, I'll push those up in a few. |
@minijackson And those are fixed. Dumb mistakes, thanks for catching them. |
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.
Pro-tip: you can do nix build -L -f ./nixos/tests/jellyfin.nix
to execute the jellyfin unit-test yourself
package = mkOption ( | ||
type = types.package; | ||
example = literalExample "pkgs.jellyfin"; | ||
description = '' | ||
Jellyfin package to use. | ||
''; | ||
); |
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.
package = mkOption ( | |
type = types.package; | |
example = literalExample "pkgs.jellyfin"; | |
description = '' | |
Jellyfin package to use. | |
''; | |
); | |
package = mkOption { | |
type = types.package; | |
example = literalExample "pkgs.jellyfin"; | |
description = '' | |
Jellyfin package to use. | |
''; | |
}; |
Restart = "on-failure"; | ||
}; | ||
}; | ||
|
||
package = mkDefault ( |
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.
package = mkDefault ( | |
services.jellyfin.package = mkDefault ( |
@minijackson And fixed yet again, you know with all the module writing I've done the past few weeks you'd think I wouldn't make such stupid mistakes. 😛 |
No worries ^^ Everything works now when We still have issues for when
Also, could you put the jellyfin_10_5 package into Sorry that the review is in such a back and forth manner... |
@minijackson Nah that's perfectly fine, first time PR'ing to nix, so there are things to learn. 😄 Changes incoming. |
@minijackson For all-packages.nix would I invoke jellyfin_10_5 via: |
Almost! If I'm not wrong, it would be |
And pushed again! |
Added jellyfin_10_5 package as well to be used for the module in nixos versions < 20.09
…ts to using the default jellyfin package if nixos version is 20.09 or greater, otherwise will default to using the new jellyfin_10_5 derivation for older systems.
And hopefully the last typo is fixed. |
Perfect! Both packages build, and the test pass with either Do you still want to be writing something for the 20.09 release notes? If you do, I think you need to add to the file |
Edit: Actually I'll let you do the Release Notes if you don't mind? :) I'll add to the release notes! Change incoming. |
No problem! I think we're good to merge, then. |
So what's the merge process like? Get someone with write access to do it? |
Yes, it's usually as simple as waiting a few days, but if it takes too long, there's a thread on NixOS's discourse for already reviewed PR: https://discourse.nixos.org/t/prs-already-reviewed/2617 |
Got it, cool. :) |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Motivation for this change
Jellyfin 10.6.0 was released, large feature set 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)