haskellPackages.mkDerivation: make license optional

`stdenv.mkDerivation` does not require meta.license to be passed, so there
is no reason `haskellPackages.mkDerivation` needs to enforce this. This
would free up cabal2nix to not report a license if it is not sure.

As I have argued in https://github.com/NixOS/cabal2nix/pull/677#issuecomment-3444635379,
it is better not to report a license than reporting an inaccurate one.

This would also allow to stop generating arbitrary strings as licenses
in cabal2nix to remove string values to facilitate more cleanliness in
the spirit of https://github.com/NixOS/nixpkgs/pull/445672, though the
question is whether it is wise to remove the meta data altogether.
This commit is contained in:
sternenseemann
2025-10-26 12:04:29 +01:00
parent 3c0492fef3
commit 03f27237ac
@@ -96,14 +96,14 @@ in
libraryFrameworkDepends ? [ ],
executableFrameworkDepends ? [ ],
homepage ? "https://hackage.haskell.org/package/${pname}",
platforms ? with lib.platforms; all, # GHC can cross-compile
platforms ? lib.platforms.all, # GHC can cross-compile
badPlatforms ? lib.platforms.none,
hydraPlatforms ? null,
hyperlinkSource ? true,
isExecutable ? false,
isLibrary ? !isExecutable,
jailbreak ? false,
license,
license ? null,
enableParallelBuilding ? true,
maintainers ? null,
teams ? null,
@@ -1031,10 +1031,11 @@ lib.fix (
};
meta = {
inherit homepage license platforms;
inherit homepage platforms;
}
// optionalAttrs (args ? broken) { inherit broken; }
// optionalAttrs (args ? description) { inherit description; }
// optionalAttrs (args ? license) { inherit license; }
// optionalAttrs (args ? maintainers) { inherit maintainers; }
// optionalAttrs (args ? teams) { inherit teams; }
// optionalAttrs (args ? hydraPlatforms) { inherit hydraPlatforms; }