git.iko.soy/typeable/cabal2nix
on master help sign in
improve license error
commitd2dceba09670302d14516d76116238ed0e4d92c0 authorProfpatsch <mail@profpatsch.de> dateSun 16 Apr 2017, 08:53 (10 years ago) parent9e55aab
1 file changed+5−2
src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs+5−2
src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs+5−2
@@ -1,7 +1,9 @@
11module Distribution.Nixpkgs.Haskell.FromCabal.License ( fromCabalLicense ) where
22
33import Distribution.Nixpkgs.License
4−import Distribution.License ( License(..) )
4+import Distribution.License ( License(..), knownLicenses )
5+import Distribution.Text (display)
6+import Data.List (intercalate)
57import Data.Version
68
79-- TODO: Programatically strip trailing zeros from license version numbers.
@@ -31,4 +33,5 @@ fromCabalLicense (Apache Nothing) = Known "stdenv.lib.lice
3133fromCabalLicense (Apache (Just (Version [2,0] []))) = Known "stdenv.lib.licenses.asl20"
3234fromCabalLicense ISC = Known "stdenv.lib.licenses.isc"
3335fromCabalLicense OtherLicense = Unknown Nothing
34−fromCabalLicense l = error $ "Distribution.Nixpkgs.Haskell.FromCabal.License.fromCabalLicense: unknown license " ++ show l
36+fromCabalLicense l = error $ "Distribution.Nixpkgs.Haskell.FromCabal.License.fromCabalLicense: unknown license"
37+ ++ show l ++"\nChoose one of: " ++ intercalate ", " (map display knownLicenses)