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
Initial VDR integration #32050
Initial VDR integration #32050
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.
Merge conflict
Thanks for reviewing. I updated to nixos-unstable and added two patches. |
@GrahamcOfBorg build vdr |
Failure on x86_64-linux (full log) Attempted: vdr Partial log (click to expand)
|
No attempt on x86_64-darwin (full log) The following builds were skipped because they don't evaluate on x86_64-darwin: vdr Partial log (click to expand)
|
Failure on aarch64-linux (full log) Attempted: vdr Partial log (click to expand)
|
x86_64-linux: fixed the gcc-7 compatibility issue. |
used same plugin mechanism as kodi does
updated PR contains:
|
mkdir -p "${cfg.videoDir}" | ||
chown vdr:vdr "${cfg.videoDir}" | ||
fi | ||
''; |
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.
It is better to use systemd.tmpfiles.rules
instead of activation scripts, which are executed unconditionally on every switch.
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.
videoDir is the folder where all recordings are put in. tmpfiles is a little bit missleading. I put responsibility to admin. Folder has to exist.
pkgs/top-level/all-packages.nix
Outdated
++ optional (config.vdr.enableSvdrpDemo or false) svdrpdemo | ||
++ optional (config.vdr.enableText2Skin or false) text2skin | ||
++ optional (config.vdr.enableVnsiServer or false) vnsiserver | ||
); |
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.
Instead of so many options cannot users just pass them to vdrPlugins { plugins = [];}
?
|
||
if ! [ -d "${libDir}" ]; then | ||
mkdir -p "${libDir}" | ||
cp --dereference -r "${cfg.package}"/share/vdr/conf/* "${libDir}" |
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 one should be part of the service. Also use touch for a file in libDir
afterwards so the command get repeated on failure by checking for the existence of the file instead of the existence of the directory.
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.
It is OK to remove that feature.
''; | ||
|
||
security.sudo.configFile = '' | ||
vdr ALL=(root) NOPASSWD:${pkgs.utillinux}/bin/rtcwake |
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 one also needs sudo to be activated I think.
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.
That's true. I think it was a bad design to expect that rtcwake is used during shutdown. Will be removed.
###### implementation | ||
|
||
config = mkIf cfg.enable { | ||
environment.systemPackages = [ cfg.package ]; |
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.
Does this needs to be in PATH
?
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.
No not needed. Will be removed.
package = mkOption { | ||
type = types.package; | ||
default = pkgs.vdr-with-plugins; | ||
description = "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.
Add here an example using wrapVdr
.
}; | ||
|
||
extraArguments = mkOption { | ||
type = types.str; |
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.
Better to make this a list.
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.
right, much better. Will use it with lib.escapeShellArgs
if ! [ -d "${libDir}" ]; then | ||
mkdir -p "${libDir}" | ||
cp --dereference -r "${cfg.package}"/share/vdr/conf/* "${libDir}" | ||
chown -R vdr:vdr "${libDir}" |
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.
You can also use systemd's StateDirectory
option to automatically create the directory and chown it to the user.
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.
OK, but copy of good defaults if folder doesn't exist will the be removed.
system.activationScripts.vdr = '' | ||
if ! [ -d /var/cache/vdr ]; then | ||
mkdir -p /var/cache/vdr | ||
chown vdr:vdr /var/cache/vdr |
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 systemd's CacheDirectory
here.
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.
CacheDirectory matches perfectly.
@Mic92 Thanks a lot for all the comments. I will take a bit of time to incorporate all your good recommendations. |
Please don't mark reviews as resolves unless you have also pushed the changes, where you addressed the review. |
@GrahamcOfBorg eval |
buildInputs = [ gettext vdr ]; | ||
nativeBuildInputs = [ pkgconfig ]; | ||
preConfigure = "cd PLUGINS/src/${name}"; | ||
installFlags = [ "DESTDIR=$(out)" "PREFIX=" ]; |
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.
Usually this comes with its own set of problems using DESTDIR instead of PREFIX when it uses PREFIX somewhere in the source. What was the offending file that could that ignored PREFIX, when installing?
name = "vdr-${name}-${version}"; | ||
inherit (vdr) src; | ||
buildInputs = [ gettext vdr ]; | ||
nativeBuildInputs = [ pkgconfig ]; |
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.
gettext also is a nativeBuildInput.
|
||
postPatch = "substituteInPlace Makefile --replace libsystemd-daemon libsystemd"; | ||
|
||
buildInputs = [ fontconfig libjpeg libcap freetype perl ] |
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 perl is not linked at runtime or used in runtime scripts, it should be also in nativeBuildInputs.
++ stdenv.lib.optional enableSystemd "SDNOTIFY=1" | ||
++ stdenv.lib.optional enableBidi "BIDI=1"; | ||
|
||
propagatedBuildInputs = [ pkgconfig gettext ]; |
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.
Should this not be in nativeBuildInputs?
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.
Every vdr plugin need to have the same build tools than vdr itself. If will you propagatedNavtiveBuildInputs. If you want the plugin descriptions more explicit I can change it to no propagated.
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.
The problem is that it also propagate to every other package that uses vdr somehow, which can be surprising at times. You can abstract it way in a variable or so or use vdr.propagatedBuildInputs
explicit.
pcre | ||
perl # for pod2man and pos2html | ||
utillinux | ||
groff |
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.
perl
, utillinux
and groff
probably belong to nativeBuildInputs.
|
||
buildInputs = [ vdr graphicsmagick ]; | ||
|
||
buildFlags = [ "DESTDIR=$(out)" ]; |
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.
also here the question as above regarding PREFIX instead of DESTDIR.
-e 's,IMAGELIB = imagemagick,IMAGELIB = graphicsmagic,' \ | ||
-e 's,^VDRDIR *=.*,VDRDIR = ${vdr.dev}/include/vdr,' \ | ||
-e 's,^LOCALEDIR *=.*,LOCALEDIR = $(DESTDIR)/share/locale,' \ | ||
-e 's,^LIBDIR *=.*,LIBDIR = $(DESTDIR)/lib/vdr,' |
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.
You can also override variables by using makeFlags
instead of sed
.
|
||
buildInputs = [ vdr boost libconvpp libfritzpp libnetpp liblogpp ]; | ||
|
||
installFlags = [ "DESTDIR=$(out)" ]; |
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.
see above.
nixos/modules/misc/ids.nix
Outdated
@@ -338,6 +338,7 @@ | |||
minetest = 311; | |||
rss2email = 312; | |||
cockroachdb = 313; | |||
vdr = 314; |
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.
not required, will be allocated on first use:
vdr = 314; |
nixos/modules/misc/ids.nix
Outdated
@@ -636,6 +637,7 @@ | |||
minetest = 311; | |||
rss2email = 312; | |||
cockroachdb = 313; | |||
vdr = 314; |
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.
same here:
vdr = 314; |
|
||
package = mkOption { | ||
type = types.package; | ||
default = pkgs.vdr; |
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.
To fix the aarch64 build we also need a defaultText = "pkgs.vdr"
.
Co-Authored-By: ck3d <ck3d@gmx.de>
@Mic92 Thanks for all our good comments! Could you please have once more a look to my PR. |
See #52686 |
vdr: revisited version of #32050
Motivation for this change
Integrated VDR and some plugins into NixOS.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)