GithubHelp home page GithubHelp logo

fuuzetsu / stackage2nix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from typeable/stackage2nix

0.0 3.0 0.0 128 KB

Generate Nix build instructions from a Stack file

License: BSD 3-Clause "New" or "Revised" License

Haskell 16.87% Shell 0.29% Nix 82.84%

stackage2nix's Introduction

stackage2nix

Build Status

stackage2nix converts a Stack file into a Nix Haskell packages set. It creates LTS Stackage packages set, and applies appropriate overrides on top of it.

Install

You can install stackage2nix from the Nix expression:

nix-env -i -f ./nix/stackage2nix

It provides pre-configured wrapper around the raw executable with runtime PATH and all auxiliary flags set up.

Executable

stackage2nix \
  --lts-haskell "$LTS_HASKELL_REPO" \
  --all-cabal-hashes "$ALL_CABAL_HASHES_REPO" \
  .

stackage2nix has three required arguments:

Produced Nix derivation split on following files:

  • packages.nix - Base Stackage packages set
  • configuration-packages.nix - Compiler configuration
  • default.nix - Final Haskell packages set with all overrides applied

A particular package from result Haskell packages set can be built with:

nix-build -A <package-name>

See also the blog post about history and motivation behind the project.

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 pkgs.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

Examples

For other examples of stackage2nix usage, see 4e6/stackage2nix-examples repository. It verifies stackage2nix by running it on different public projects.

stackage2nix's People

Contributors

4e6 avatar nc6 avatar fuuzetsu avatar dredozubov avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.