git.iko.soy/typeable/cabal2nix
on master help sign in
Normalize flags to all-lowercase before handing them to Cabal.

Cabal expects the payload of the "opaque" FlagName type to be spelled in all lower-case characters. The mkFlagName function, however, does not ensure that invariant. We need a good solution to avoid this pitfall. For the time being, we simply convert all flags used in this module to lower-case ourselves, but chances are that there are other places in cabal2nix that create improper FlagName instances through the official API. Related: https://github.com/NixOS/nixpkgs/issues/73392

commit650d5300c6bb5632bbab6fcb2d939fb476e469c5 authorPeter Simons <simons@cryp.to> dateFri 15 Nov 2019, 21:29 (7 years ago) parent39f6c39
1 file changed+6−2
src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+6−2
src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs+6−2
@@ -4,6 +4,7 @@ module Distribution.Nixpkgs.Haskell.FromCabal.Flags ( configureCabalFlags ) wher
44
55import Distribution.Nixpkgs.Haskell.OrphanInstances ( )
66
7+import Data.Char
78import Distribution.Package
89import Distribution.PackageDescription
910import Distribution.Version
@@ -57,7 +58,10 @@ configureCabalFlags' (PackageIdentifier name version)
5758 | otherwise = []
5859
5960enable :: String -> (FlagName,Bool)
60−enable name = (mkFlagName name, True)
61+enable name = (mkFlagName' name, True)
6162
6263disable :: String -> (FlagName,Bool)
63−disable name = (mkFlagName name, False)
64+disable name = (mkFlagName' name, False)
65+
66+mkFlagName' :: String -> FlagName
67+mkFlagName' = mkFlagName . map toLower