Skip to content

kodi: make overrideAttrs and withPackages composable - #304097

Merged
aanderse merged 4 commits into
NixOS:masterfrom
nvmd:master+kodi-composable
Apr 18, 2024
Merged

aanderse merged 4 commits into
NixOS:masterfrom
nvmd:master+kodi-composable

Conversation

@nvmd

@nvmd nvmd commented Apr 14, 2024 •

Copy link
Copy Markdown
Member

Description of changes

This work is an up-to-date version of #209580 which has been stale for a long time already. Last time it was postponed due to an upcoming Kodi release, hopefully, we could merge it this time.
I've been using those changes and supporting them for about 2 years in my Nixos configuration with zero problems.
I've also improved it in a couple of places regarding the ability to override, and consistent handling of existing configuration parameters (opticalSupport, vdpauSupport).

This will make customizing Kodi for other platforms (e.g. Raspberry Pi, which require custom ffmpeg, libcec and other optimizations) much easier when all of overrideAttrs, override, and withPackages are needed at the same time.

Could be tested with something along these lines: (there is also test flake example in the original PR)

with import <nixpkgs> { system = "aarch64-linux"; };

let
  kodi-rpi = ((kodi.overrideAttrs (old: {
    pname = "kodi-rpi";

    ffmpeg = pkgs.ffmpeg_4 {
      withDav1 = true;
      withVaapi = false;
      withVdpau = false;
    };
  })).override {
    libcec = libcec.override {
      withLibraspberrypi = true;
    };
    vdpauSupport = false;
    dav1dSupport = true;
    gbmSupport = true;
  });
in kodi-rpi.withPackages (pkgs: with pkgs; [
    inputstream-adaptive
    inputstream-ffmpegdirect
    inputstream-rtmp
    joystick
    libretro
    libretro-2048
    libretro-fuse
    libretro-genplus
    libretro-mgba
    libretro-nestopia
    libretro-snes9x
    pvr-iptvsimple
    vfs-libarchive
    vfs-rar
])

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg Bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Apr 14, 2024
@nvmd
nvmd force-pushed the master+kodi-composable branch from cb5f8d4 to b08af64 Compare April 17, 2024 16:02
@github-actions github-actions Bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Apr 17, 2024
@nvmd
nvmd force-pushed the master+kodi-composable branch from b08af64 to 0be3972 Compare April 17, 2024 16:04
dwagenk and others added 4 commits April 17, 2024 19:04
This pattern allows for easier overriding of the derivations attributes like
described and discussed in NixOS#119942.

In this context
- adapt the handling of the version and revision handling so overriding it gets
  reflected in the version string that kodi displays in the UI
- make the bundled dependencies available for overriding
- make some of the existing compilation flags to be overridable
  consistently with existing options
Using withPackage on a kodi derivation that was modified with overrideAttrs
lead to the modifications being discarded. With the previous adaptions to the
kodi derivation we can now modify the wrapper that allows using both
overrideAttrs and withPackage to form a custom kodi derivation with plugins.
@nvmd
nvmd force-pushed the master+kodi-composable branch from 0be3972 to a55f8bd Compare April 17, 2024 16:04
@github-actions github-actions Bot removed the 6.topic: python Python is a high-level, general-purpose programming language. label Apr 17, 2024
@nvmd

nvmd commented Apr 17, 2024

Copy link
Copy Markdown
Member Author

Updated for Kodi 21.0 (#303497)

@ofborg ofborg Bot added the 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. label Apr 17, 2024
@aanderse

Copy link
Copy Markdown
Member

@SuperSandro2000 - any chance you can take a look at this as well? ❤️

@nvmd

nvmd commented Apr 17, 2024

Copy link
Copy Markdown
Member Author

Even though this has nothing to do with this PR, it now rather unfortunately weakly depends on #304845, because apache-commons-text suddenly is no longer at the source url and ofborg's compilation checks fail.

@SuperSandro2000 SuperSandro2000 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks alright to me

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one person. label Apr 17, 2024

@aanderse aanderse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks everyone!

@aanderse
aanderse merged commit b9f2ef1 into NixOS:master Apr 18, 2024
@nvmd
nvmd deleted the master+kodi-composable branch April 18, 2024 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants