1# How to create Nix builds for your own private Haskell packages
3The general structure will be the same, independent of the use of
6Let us assume for now that we have already generated a `pkgs.nix`
7expression. The following file then produces a package set:
12 # Import the Haskell.nix library,
13 haskell = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
15 # Import the file you will create in the stack-to-nix or cabal-to-nix step.
16 my-pkgs = import ./pkgs.nix;
18 # Stack projects use this:
19 pkgSet = haskell.mkStackPkgSet {
22 # these extras will provide additional packages
23 # ontop of the package set. E.g. extra-deps
24 # for stack packages. or local packages for
28 # specific package overrides would go here
30 # packages.cbors.package.ghcOptions = "-Werror";
31 # packages.cbors.patches = [ ./one.patch ];
32 # packages.cbors.flags.optimize-gmp = false;
33 # It may be better to set flags in stack.yaml instead (overrides will
34 # be included for them automatically by `stack-to-nix`).
38 # Cabal projects use this:
39 pkgSet = haskell.mkCabalProjectPkgSet {
43 # specific package overrides would go here
45 # packages.cbors.package.ghcOptions = "-Werror";
46 # packages.cbors.patches = [ ./one.patch ];
47 # To override a flag you will need to use mkOverride to make
48 # it clear that you wish to replace the value found in the
49 # `plan.json` file (all the flags values are included there
51 # packages.cbors.flags.optimize-gmp = stdenv.lib.mkOverride 10 false;
52 # It may be better to set flags in `cabal.project` instead.
56in pkgSet.config.hsPkgs // { _config = pkgSet.config; }
59With this setup you can then start building the components of
63nix build -f default.nix $pkg.components.library
66to build the library for `$pkg` or
69nix build -f default.nix $pkg.components.exes.$exe
72to build a specific executable. The same holds for test suites and benchmarks.
74- [Generating a `pkgs.nix` for a Stack project](./stack-projects.md)
75- [Generating a `pkgs.nix` for a Cabal project](./cabal-projects.md)
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