From 03f27237ac76fb83c4314e22ea6fdf6bf68a42ce Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 26 Oct 2025 12:04:29 +0100 Subject: [PATCH] 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. --- pkgs/development/haskell-modules/generic-builder.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 9e8953079690..d69ccb7b5372 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -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; }