By default, uv2nix builds virtual environments. If you want to hide the fact that an application is implemented via a Python virtualenv and instead provide a clean Nix package, use the mkApplication utility function.
mkApplication creates a derivation that wraps the virtual environment but only links the content present in the package attribute. This automatically excludes virtualenv-specific files like Python interpreters, activation scripts, and pyvenv.cfg, while including application-specific files like binaries, man pages, and systemd units.
{
packages = forAllSystems (
system:
let
pythonSet = pythonSets.${system};
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs.callPackages pyproject-nix.build.util { }) mkApplication;
in
{
default = mkApplication {
venv = pythonSet.mkVirtualEnv "application-env" workspace.deps.default;
package = pythonSet.hello-world;
};
}
);
}