git.iko.soy/typeable/cabal2nix
on master help sign in
toNixName: start a hard-coded list of naming scheme exceptions.

Just de-capitalizing the first character doesn't work well in practice.

commit80e603cf2bd838dbad3973c370ea69d2372bd302 authorPeter Simons <simons@cryp.to> dateFri 5 Aug 2011, 21:29 (15 years ago) parent63a5c25
2 files changed+5−4
cabal2nix.cabal+3−3 cabal2nix.hs+2−1
cabal2nix.cabal+3−3
@@ -1,5 +1,5 @@
11Name: cabal2nix
2−Version: 1.5
2+Version: 1.6
33Copyright: (c) 2011 Peter Simons
44License: BSD3
55License-File: LICENSE
@@ -20,8 +20,8 @@ Description: This utility converts Cabal files into Nix build
2020 file. That path can be an HTTP URL or local file
2121 path. For example:
2222 .
23− > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.5/cabal2nix.cabal
24− > cabal2nix file:///tmp/cabal2nix.cabal 0m7zgsd1pxmw504xpvl7dg25ana6dkk1mcyjj4c1wdbkvhvbn3gn
23+ > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.6/cabal2nix.cabal
24+ > cabal2nix file:///tmp/cabal2nix.cabal
2525 > cabal2nix /tmp/cabal2nix.cabal 0m7zgsd1pxmw504xpvl7dg25ana6dkk1mcyjj4c1wdbkvhvbn3gn
2626 .
2727 The second argument -- the hash of the source
cabal2nix.hs+2−1
@@ -34,7 +34,8 @@ data Pkg = Pkg PkgName PkgVersion PkgSHA256 PkgURL PkgDescription PkgLicense Pkg
3434
3535toNixName :: String -> String
3636toNixName [] = error "toNixName: empty string is not a valid argument"
37−toNixName name = f ((toLower (head name)) : tail name)
37+toNixName "Cabal" = "cabal"
38+toNixName name = f name
3839 where
3940 f [] = []
4041 f ('-':c:cs) | c `notElem` "-" = toUpper c : f cs