Skip to content
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

gst_all_1: use newScope to create package set #110459

Closed
wants to merge 2 commits into from

Conversation

B4dM4n
Copy link
Contributor

@B4dM4n B4dM4n commented Jan 22, 2021

Motivation for this change

Overriding gst_all_1.gstreamer is a pain, because it is contained in a rec set and manually passes itself and other dependencies from the set directly to dependent packages. So in order to propagate a overwritten gstreamer to it's dependent packages an overlay like this is required:

final: prev: {
  gst_all_1 = prev.gst_all_1 // rec {
    gstreamer = prev.gst_all_1.gstreamer.overrideAttrs (old: { ... });

    gst-plugins-base = prev.gst_all_1.gst-plugins-base.override { inherit gstreamer; };

    gst-plugins-good = prev.gst_all_1.gst-plugins-good.override { inherit gst-plugins-base; };

    ...
  };
}

This overlay would also miss new packages in the set depending on any of the current packages.

Using lib.makeScope would allow to conveniently override any package in the set and ensure it is used in all dependent packages:

final: prev: {
  gst_all_1 = prev.gst_all_1.overrideScope' (final: prev: {
    gstreamer = prev.gstreamer.overrideAttrs (old: { ... });
  });
}
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jan 22, 2021
@B4dM4n B4dM4n requested a review from jtojnar January 22, 2021 11:35
monado = callPackage ../applications/graphics/monado {
inherit (gst_all_1) gstreamer gst-plugins-base;
};
monado = gst_all_1.callPackage ../applications/graphics/monado { };
Copy link
Member

Choose a reason for hiding this comment

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

I think we should avoid this pattern in package sets: using the callPackage from a different scope breaks composition. In these cases it is in my opinion much better to pass in the subpackage set.

Copy link
Member

Choose a reason for hiding this comment

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

Related RFC NixOS/rfcs#83.

@jtojnar
Copy link
Member

jtojnar commented Jan 22, 2021

Alternately, we could move those packages to top-level. But scoping sound good to me too. cc @worldofpeace

@worldofpeace
Copy link
Contributor

@jtojnar I think some time in the past came upon that the need for a gst_all_1 has passed. It was really confusing to have old versions of gst as the top level attributes. I would be in favor of moving them all to top-level and keeping gst_all_1 as an alias.

@stale
Copy link

stale bot commented Jul 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 21, 2021
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 20, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@Princemachiavelli
Copy link
Contributor

I think #131295 fixed this by removing rec. I'm able to easily override gstreamer with the following overlay (there might be an even better way but this makes sense to me):

final: prev: {
  gst_all_1 = prev.gst_all_1 // {
      gstreamer = prev.gst_all_1.gstreamer.overrideAttrs( prev: {
        pname= prev.pname + "-foo";
      });
  };
}

Checking gst_all_1.gst-plugins-base shows that the override to gstreamer is pulled in without having to manual pass the new `gstreamer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants