Declarative priorities for flakes

How do I declare priorities for installing flakes?

E.g., I want to install psutils and texlive.combined.scheme-small in the same profile, but with different priorities. I want to do this declaratively, rather than imperatively on the cmdline, for all the good reasons that we know & love.

Pre-flakes, I did this with a snippet like:

  inherit psutils;
  scheme-small =
    let override = old: { meta = old.meta // { priority = 7; }; };
    in texlive.combined.scheme-small.overrideAttrs(override);

But with flakes, this seems to be ineffective:

error: packages '/nix/store/avap1gmqzhzi9hl9wsfs24nn2bjqr7zf-texlive-combined-small-2021-final/bin/epsffit' and '/nix/store/73wmkxhna80x1j6z0x8zpgsbx0fhl180-psutils-17/bin/epsffit' have the same priority 5...

Is there some way of achieving this? If not, is this a design feature, or a pending feature (i.e., we’d like it, but nobody has yet gotten the tuits), or a bug?

I did see these topics ([new CLI] conflicting packages with nix profile install, Poor user experience around nix profile install and priorities); but neither seem to address the matter of declaration.

Thank you.

Where do you put these snippets and what commands do you run?

The snippets are from flake.nix; minimal example

{
  description = "reduced example";

  inputs = {
    nixpkgs.url     = "github:nixos/nixpkgs/be44bf67"; # nixos-22.05 2022-10-15
    flake-utils.url = "github:numtide/flake-utils/c0e246b9";
  };

  outputs = { self, nixpkgs, flake-utils }:
    flake-utils.lib.eachSystem [flake-utils.lib.system.x86_64-linux] (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
      in
        {
          packages =
            with pkgs;
            flake-utils.lib.flattenTree {
              inherit psutils;
              scheme-small =
                let override = old: { meta = old.meta // { priority = 7; }; };
                in  texlive.combined.scheme-small.overrideAttrs(override);
          };
        }
    );
}

The command is:

nix profile install --profile /tmp/tmp-profile .#scheme-small .#psutils