git.iko.soy/typeable/cabal2nix
on master help sign in
Support new license types introduced in Cabal 1.22.x.

Fixes https://github.com/NixOS/cabal2nix/issues/161.

commitd08c2970e9c74948e81e7b926b64e5d7d1dd07b7 authorPeter Simons <simons@cryp.to> dateTue 14 Apr 2015, 15:05 (12 years ago) parentb2e014f
1 file changed+14−1
src/Cabal2Nix/License.hs+14−1
src/Cabal2Nix/License.hs+14−1
@@ -1,3 +1,5 @@
1+{-# LANGUAGE CPP #-}
2+
13module Cabal2Nix.License ( fromCabalLicense ) where
24
35import Distribution.Nixpkgs.License
@@ -15,12 +17,23 @@ fromCabalLicense (LGPL (Just (Version [3] []))) = Known "stdenv.lib.lice
1517fromCabalLicense (AGPL Nothing) = Unknown (Just "AGPL")
1618fromCabalLicense (AGPL (Just (Version [3] []))) = Known "stdenv.lib.licenses.agpl3"
1719fromCabalLicense (AGPL (Just (Version [3,0] []))) = Known "stdenv.lib.licenses.agpl3"
18−fromCabalLicense (UnknownLicense "BSD2") = Known "stdenv.lib.licenses.bsd2"
20+#if MIN_VERSION_Cabal(1,22,0)
21+fromCabalLicense (MPL (Version [2,0] [])) = Known "stdenv.lib.licenses.mpl20"
22+#else
1923fromCabalLicense (UnknownLicense "MPL-2.0") = Known "stdenv.lib.licenses.mpl20"
24+#endif
25+#if MIN_VERSION_Cabal(1,22,0)
26+fromCabalLicense (BSD2) = Known "stdenv.lib.licenses.bsd2"
27+#else
28+fromCabalLicense (UnknownLicense "BSD2") = Known "stdenv.lib.licenses.bsd2"
29+#endif
2030fromCabalLicense BSD3 = Known "stdenv.lib.licenses.bsd3"
2131fromCabalLicense BSD4 = Unknown (Just "BSD4")
2232fromCabalLicense MIT = Known "stdenv.lib.licenses.mit"
2333fromCabalLicense PublicDomain = Known "stdenv.lib.licenses.publicDomain"
34+#if MIN_VERSION_Cabal(1,22,0)
35+fromCabalLicense UnspecifiedLicense = Known "stdenv.lib.licenses.unfree"
36+#endif
2437fromCabalLicense AllRightsReserved = Known "stdenv.lib.licenses.unfree"
2538fromCabalLicense (Apache Nothing) = Known "stdenv.lib.licenses.asl20"
2639fromCabalLicense (Apache (Just (Version [2,0] []))) = Known "stdenv.lib.licenses.asl20"