4`cabal2nix` converts a single Cabal file into a single Nix build expression.
7 $ cabal2nix cabal://mtl
8 { mkDerivation, base, stdenv, transformers }:
12 sha256 = "1icdbj2rshzn0m1zz5wa7v3xvkf6qw811p4s7jgqwvx1ydwrvrfa";
13 libraryHaskellDepends = [ base transformers ];
14 homepage = "http://github.com/ekmett/mtl";
15 description = "Monad classes, using functional dependencies";
16 license = stdenv.lib.licenses.bsd3;
19Cabal files can be referred to using the magic URL `cabal://NAME-VERSION`,
20which will automatically download the file from Hackage. Alternatively, a
21direct `http://host/path/pkg.cabal` URL can be provided, as well as a
22`file:///local/path/pkg.cabal` URI that doesn't depend on network access.
23However, if the source hash is not already in `cabal2nix`'s cache or provided
24using the `--sha256` option, `cabal2nix` still needs to download the source
25code to compute the hash, which obviously still causes network traffic. Run the
26utility with `--help` to see the complete list of supported command line flags.
28Detailed instructions how to use those generated files with Nix can be found at
29http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure.
31`cabal2nix` can also build derivations for projects from other sources than
32hackage. You only need to provide an URI that points to a cabal project. The
33most common usecase for this is probably to generate a derivation for a project
34on the local file system:
36 $ cabal get mtl-2.2.1 && cd mtl-2.2.1
38 { mkDerivation, base, stdenv, transformers }:
43 libraryHaskellDepends = [ base transformers ];
44 homepage = "http://github.com/ekmett/mtl";
45 description = "Monad classes, using functional dependencies";
46 license = stdenv.lib.licenses.bsd3;
49This derivation will not fetch from hackage, but instead use the directory which
50contains the derivation as the source repository.
52`cabal2nix` currently supports the following repository types:
55* source archive (zip, tar.gz, ...) from http or https URL or local file.
56* git, mercurial, svn or bazaar repository
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list