diff --git a/pkgs/by-name/py/pyspread/package.nix b/pkgs/by-name/py/pyspread/package.nix index 1eef51e14bae..3e19974c4fe4 100644 --- a/pkgs/by-name/py/pyspread/package.nix +++ b/pkgs/by-name/py/pyspread/package.nix @@ -8,21 +8,20 @@ }: let - # get rid of rec - pname = "pyspread"; - version = "2.4"; - src = fetchPypi { - inherit pname version; - hash = "sha256-MZlR2Rap5oMRfCmswg9W//FYFkSEki7eyMNhLoGZgJM="; - }; inherit (libsForQt5) qtsvg wrapQtAppsHook ; in -python3.pkgs.buildPythonApplication { +python3.pkgs.buildPythonApplication (finalAttrs: { format = "setuptools"; - inherit pname version src; + pname = "pyspread"; + version = "2.4"; + src = fetchPypi { + pname = "pyspread"; + inherit (finalAttrs) version; + hash = "sha256-MZlR2Rap5oMRfCmswg9W//FYFkSEki7eyMNhLoGZgJM="; + }; nativeBuildInputs = [ copyDesktopItems @@ -86,4 +85,4 @@ python3.pkgs.buildPythonApplication { mainProgram = "pyspread"; maintainers = [ ]; }; -} +}) diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index 82c59397cbb3..f3e5249c189e 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -99,7 +99,12 @@ let "wheel" ]; - cleanAttrs = flip removeAttrs [ +in + +lib.extendMkDerivation { + constructDrv = stdenv.mkDerivation; + + excludeDrvArgNames = [ "disabled" "checkPhase" "checkInputs" @@ -114,93 +119,89 @@ let "build-system" ]; -in - -{ - # Build-time dependencies for the package - nativeBuildInputs ? [ ], - - # Run-time dependencies for the package - buildInputs ? [ ], - - # Dependencies needed for running the checkPhase. - # These are added to buildInputs when doCheck = true. - checkInputs ? [ ], - nativeCheckInputs ? [ ], - - # propagate build dependencies so in case we have A -> B -> C, - # C can import package A propagated by B - propagatedBuildInputs ? [ ], - - # Python module dependencies. - # These are named after PEP-621. - dependencies ? [ ], - optional-dependencies ? { }, - - # Python PEP-517 build systems. - build-system ? [ ], - - # DEPRECATED: use propagatedBuildInputs - pythonPath ? [ ], - - # Enabled to detect some (native)BuildInputs mistakes - strictDeps ? true, - - outputs ? [ "out" ], - - # used to disable derivation, useful for specific python versions - disabled ? false, - - # Raise an error if two packages are installed with the same name - # TODO: For cross we probably need a different PYTHONPATH, or not - # add the runtime deps until after buildPhase. - catchConflicts ? (python.stdenv.hostPlatform == python.stdenv.buildPlatform), - - # Additional arguments to pass to the makeWrapper function, which wraps - # generated binaries. - makeWrapperArgs ? [ ], - - # Skip wrapping of python programs altogether - dontWrapPythonPrograms ? false, - - # Don't use Pip to install a wheel - # Note this is actually a variable for the pipInstallPhase in pip's setupHook. - # It's included here to prevent an infinite recursion. - dontUsePipInstall ? false, - - # Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs - permitUserSite ? false, - - # Remove bytecode from bin folder. - # When a Python script has the extension `.py`, bytecode is generated - # Typically, executables in bin have no extension, so no bytecode is generated. - # However, some packages do provide executables with extensions, and thus bytecode is generated. - removeBinBytecode ? true, - - # pyproject = true <-> format = "pyproject" - # pyproject = false <-> format = "other" - # https://github.com/NixOS/nixpkgs/issues/253154 - pyproject ? null, - - # Several package formats are supported. - # "setuptools" : Install a common setuptools/distutils based package. This builds a wheel. - # "wheel" : Install from a pre-compiled wheel. - # "pyproject": Install a package using a ``pyproject.toml`` file (PEP517). This builds a wheel. - # "egg": Install a package from an egg. - # "other" : Provide your own buildPhase and installPhase. - format ? null, - - meta ? { }, - - doCheck ? true, - - ... -}@attrs: - -let - # Keep extra attributes from `attrs`, e.g., `patchPhase', etc. - self = stdenv.mkDerivation ( + extendDrvArgs = finalAttrs: + { + # Build-time dependencies for the package + nativeBuildInputs ? [ ], + + # Run-time dependencies for the package + buildInputs ? [ ], + + # Dependencies needed for running the checkPhase. + # These are added to buildInputs when doCheck = true. + checkInputs ? [ ], + nativeCheckInputs ? [ ], + + # propagate build dependencies so in case we have A -> B -> C, + # C can import package A propagated by B + propagatedBuildInputs ? [ ], + + # Python module dependencies. + # These are named after PEP-621. + dependencies ? [ ], + optional-dependencies ? { }, + + # Python PEP-517 build systems. + build-system ? [ ], + + # DEPRECATED: use propagatedBuildInputs + pythonPath ? [ ], + + # Enabled to detect some (native)BuildInputs mistakes + strictDeps ? true, + + outputs ? [ "out" ], + + # used to disable derivation, useful for specific python versions + disabled ? false, + + # Raise an error if two packages are installed with the same name + # TODO: For cross we probably need a different PYTHONPATH, or not + # add the runtime deps until after buildPhase. + catchConflicts ? (python.stdenv.hostPlatform == python.stdenv.buildPlatform), + + # Additional arguments to pass to the makeWrapper function, which wraps + # generated binaries. + makeWrapperArgs ? [ ], + + # Skip wrapping of python programs altogether + dontWrapPythonPrograms ? false, + + # Don't use Pip to install a wheel + # Note this is actually a variable for the pipInstallPhase in pip's setupHook. + # It's included here to prevent an infinite recursion. + dontUsePipInstall ? false, + + # Skip setting the PYTHONNOUSERSITE environment variable in wrapped programs + permitUserSite ? false, + + # Remove bytecode from bin folder. + # When a Python script has the extension `.py`, bytecode is generated + # Typically, executables in bin have no extension, so no bytecode is generated. + # However, some packages do provide executables with extensions, and thus bytecode is generated. + removeBinBytecode ? true, + + # pyproject = true <-> format = "pyproject" + # pyproject = false <-> format = "other" + # https://github.com/NixOS/nixpkgs/issues/253154 + pyproject ? null, + + # Several package formats are supported. + # "setuptools" : Install a common setuptools/distutils based package. This builds a wheel. + # "wheel" : Install from a pre-compiled wheel. + # "pyproject": Install a package using a ``pyproject.toml`` file (PEP517). This builds a wheel. + # "egg": Install a package from an egg. + # "other" : Provide your own buildPhase and installPhase. + format ? null, + + meta ? { }, + + doCheck ? true, + + ... + }@attrs: + let getFinalPassthru = let @@ -283,8 +284,7 @@ let name = namePrefix + attrs.name or "${finalAttrs.pname}-${finalAttrs.version}"; in - (cleanAttrs attrs) - // { + { inherit name; inherit catchConflicts; @@ -447,8 +447,7 @@ let "enabledTestPaths" "enabledTests" ] attrs - ) - ); + ); # This derivation transformation function must be independent to `attrs` # for fixed-point arguments support in the future. @@ -468,6 +467,4 @@ let }; in drv: disablePythonPackage (toPythonModule drv); - -in -transformDrv self +} diff --git a/pkgs/development/interpreters/python/python-packages-base.nix b/pkgs/development/interpreters/python/python-packages-base.nix index 5b78dd0861ab..91d733a33c3e 100644 --- a/pkgs/development/interpreters/python/python-packages-base.nix +++ b/pkgs/development/interpreters/python/python-packages-base.nix @@ -23,7 +23,11 @@ let origArgs: let result = f origArgs; - overrideWith = newArgs: origArgs // lib.toFunction newArgs origArgs; + overrideWith = + if lib.isFunction origArgs then + newArgs: lib.extends (_: lib.toFunction newArgs) origArgs + else + newArgs: origArgs // lib.toFunction newArgs origArgs; in if lib.isAttrs result then result