All Projects → typeable → stackage2nix

typeable / stackage2nix

Licence: other
Generate Nix build instructions from a Stack file

Programming Languages

Nix
1067 projects
haskell
3896 projects
shell
77523 projects

Projects that are alternatives of or similar to stackage2nix

purescript.nix
📦 PureScript package management with Nix
Stars: ✭ 12 (-75%)
Mutual labels:  nix, nixpkgs
nixpkgs-python
nixpkgs-python is automatically (via pypi2nix) managed collection of nix+python expressions
Stars: ✭ 17 (-64.58%)
Mutual labels:  nix, nixpkgs
nixpkgs-review-checks
Add additional checks and more information from build logs and outputs to the reports generated by nixpkgs-review.
Stars: ✭ 27 (-43.75%)
Mutual labels:  nix, nixpkgs
Stack2nix
Generate nix expressions for Haskell projects
Stars: ✭ 93 (+93.75%)
Mutual labels:  nix, stack
yants
Yet Another Nix Type System | Source has moved to https://git.tazj.in/tree/nix/yants
Stars: ✭ 35 (-27.08%)
Mutual labels:  nix, nixpkgs
Home Manager
Manage a user environment using Nix [maintainer=@rycee]
Stars: ✭ 2,447 (+4997.92%)
Mutual labels:  nix, nixpkgs
nixpkgs-pytools
Tools for removing the tedious nature of creating nixpkgs derivations [maintainer=@costrouc]
Stars: ✭ 36 (-25%)
Mutual labels:  nix, nixpkgs
nixpkgs
My Nix system configs!
Stars: ✭ 143 (+197.92%)
Mutual labels:  nix, nixpkgs
nixpkgs
Nix Packages collection used in Nubank
Stars: ✭ 24 (-50%)
Mutual labels:  nix, nixpkgs
dotfiles
Dotfiles. Mac and *nix. Handy scripts, configurations for bash, zsh, git, asdf, Sublime Text, Karabiner-Elements, BetterTouchTool and more.
Stars: ✭ 15 (-68.75%)
Mutual labels:  nix, nixpkgs
dotfiles
No place like ~. Nix. All. The. Things.
Stars: ✭ 48 (+0%)
Mutual labels:  nix, nixpkgs
nix-bisect
Bisect nix builds. Status: alpha/proof of concept. You'll probably have to dig into the implementation if you want to use it. Built for personal use, lightly maintained. PRs welcome. Issues welcome, but I make no promises regarding responses or fix
Stars: ✭ 72 (+50%)
Mutual labels:  nix, nixpkgs
Nixpkgs
Nix Packages collection
Stars: ✭ 8,322 (+17237.5%)
Mutual labels:  nix, nixpkgs
gradle2nix
Generate Nix expressions which build Gradle-based projects.
Stars: ✭ 71 (+47.92%)
Mutual labels:  nix, nixpkgs
go2nix
Reproducible builds and development environment for Go
Stars: ✭ 88 (+83.33%)
Mutual labels:  nix, nixpkgs
crane
A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.
Stars: ✭ 348 (+625%)
Mutual labels:  nix, nixpkgs
haskell-overridez
Simplify usage of nix dependencies during haskell development
Stars: ✭ 32 (-33.33%)
Mutual labels:  nix, nixpkgs
triton
Triton Operating System
Stars: ✭ 56 (+16.67%)
Mutual labels:  nix, nixpkgs
nixpkgs-python-importer
Violate Nix philosophy, install Python packages mid-session with `from nixpkgs.scipy import scipy`.
Stars: ✭ 27 (-43.75%)
Mutual labels:  nix, nixpkgs
AhaAlgorithms
《啊哈算法》书上代码
Stars: ✭ 47 (-2.08%)
Mutual labels:  stack

stackage2nix (DEPRECATED)

Build Status

stackage2nix converts a Stack file into a Nix Haskell packages set.

Create build derivation from stack.yaml

Generate targets from stack.yaml only

stack exec -- stackage2nix .

Command creates file default.nix which overrides haskell.packages.stackage packages set. You should use typeable/nixpkgs-stackage overlay that adds LTS Stackage packages to Nixpkgs.

Build package with overlay installed:

nix-build -A stackage2nix

Generate Stackage packages for the build

If you don't want to use Stackage overlay, stackage2nix can generate required packages with --with-stackage-closure flag.

stack exec -- stackage2nix \
  --all-cabal-hashes /path/to/commercialhaskell/all-cabal-hashes \
  --lts-haskell /path/to/fpco/lts-haskell \
  --with-stackage-closure \
  ./stack.yaml

To generate Stackage packages, supply the --all-cabal-hashes flag with the path to a local clone of all-cabal-hashes checked out on the hackage branch and supply the --lts-haskell flag with the path to a local clone of lts-haskell.

stackage2nix wrapper

You can use stackage2nix wrapper from nix directory that adds required flags:

nix-env -i -f ./nix/stackage2nix
stackage2nix --with-stackage-closure ./stack.yaml

This command will produce packages.nix and configuration-packages.nix Stackage packages and its override in default.nix

Generate full Stackage

--with-stackage parameter generates full Stackage LTS in addition to the targets from stack.yaml

nix-env -i -f ./nix/stackage2nix
stackage2nix --with-stackage ./stack.yaml

Generate Stackage from LTS resolver

You can also generate only Stackage packages set from the resolver:

nix-env -i -f ./nix/stackage2nix
stackage2nix --resolver lts-10.0

This command will produce Stackage packages packages.nix, packages config configuration-packages.nix and a Haskell packages set default.nix.

Runtime dependencies

  • nix-env is required to be on PATH by the distribution-nixpkgs dependency
  • nix-prefetch-scripts is required on PATH if you have git dependencies in stack.yaml

Override result derivation

Complex projects may require some extra customization. Snippet override.nix below shows a minimal example of how to apply additional overrides on top of Haskell packages set produced by stackage2nix.

with import <nixpkgs> {};
with haskell.lib;
let haskellPackages = import ./. {};
in haskellPackages.override {
  overrides = self: super: {
    stackage2nix = disableSharedExecutables super.stackage2nix;
  };
}
nix-build -A stackage2nix override.nix

For more complex overrides and detailed information on how to work with Haskell packages in Nix, see Nixpkgs manual User’s Guide to the Haskell Infrastructure

Tests

Integration tests that build stackage2nix form different yaml configs:

STACKAGE_REPO=<path/to/stackage/repo> \
ALL_CABAL_HASHES=<path/to/all-cabal-hashes/repo> \
STACK_FILE=stack-ghc-7103.yaml \
./ci-stackage2nix
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].