git.iko.soy/typeable/cabal2nix
on master help sign in
isFreeLicense: helper function to check whether a license is free
commit614c0225ecabcb0b5707ad467773b46c7fe9d5c9 authorPeter Simons <simons@cryp.to> dateMon 26 Nov 2018, 17:52 (8 years ago) parent3f50d31
1 file changed+6
src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs+6
src/Distribution/Nixpkgs/Haskell/FromCabal/License.hs+6
@@ -3,6 +3,7 @@
33module Distribution.Nixpkgs.Haskell.FromCabal.License
44 ( fromCabalLicense
55 , fromSPDXLicense
6+ , isFreeLicense
67 ) where
78
89import Data.List (intercalate)
@@ -162,3 +163,8 @@ fromSPDXLicense (SPDX.License expr) =
162163 -- Not handled: compound expressions, not expressible in Nixpkgs.
163164 -- Use the SPDX expression as a free-form license string.
164165 Unknown (Just $ prettyShow expr)
166+
167+isFreeLicense :: Distribution.Nixpkgs.License.License -> Bool
168+isFreeLicense (Known "stdenv.lib.licenses.unfree") = False
169+isFreeLicense (Unknown Nothing) = False
170+isFreeLicense _ = True