Skip to content

Commit

Permalink
Rename to stackage2nix
Browse files Browse the repository at this point in the history
  • Loading branch information
4e6 committed Aug 21, 2017
1 parent c67c0d8 commit 064625a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 25 deletions.
20 changes: 10 additions & 10 deletions README.md
@@ -1,18 +1,18 @@
# stack2nix
# stackage2nix

[![Build Status](https://travis-ci.org/4e6/stack2nix.svg?branch=master)](https://travis-ci.org/4e6/stack2nix)
[![Build Status](https://travis-ci.org/4e6/stackage2nix.svg?branch=master)](https://travis-ci.org/4e6/stackage2nix)

`stack2nix` converts a Stack file into a Nix Haskell packages set.
`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.

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

`stack2nix` has three required arguments:
`stackage2nix` has three required arguments:
- `--lts-haskell` - path to [fpco/lts-haskell](https://github.com/fpco/lts-haskell)
- `--all-cabal-hashes` - path to [commercialhaskell/all-cabal-hashes](https://github.com/commercialhaskell/all-cabal-hashes) checked out to `hackage` branch
- `.` - path to stack.yaml file or directory
Expand All @@ -32,27 +32,27 @@ nix-build -A <package-name>

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 `stack2nix`.
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: {
stack2nix = disableSharedExecutables super.stack2nix;
stackage2nix = disableSharedExecutables super.stackage2nix;
};
}
```

```
nix-build -A stack2nix override.nix
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](http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure)


## Examples

For other examples of `stack2nix` usage, see [4e6/stack2nix-examples](https://github.com/4e6/stack2nix-examples) repository.
It verifies `stack2nix` by running it on different public projects.
For other examples of `stackage2nix` usage, see [4e6/stackage2nix-examples](https://github.com/4e6/stackage2nix-examples) repository.
It verifies `stackage2nix` by running it on different public projects.
2 changes: 1 addition & 1 deletion src/Runner.hs
Expand Up @@ -13,7 +13,7 @@ import Distribution.Package (mkPackageName, pkgName)
import Distribution.Text as Text (display)
import Language.Nix as Nix
import Options.Applicative
import Paths_stack2nix ( version )
import Paths_stackage2nix ( version )
import Runner.Cli
import Stack.Config
import Stack.Types
Expand Down
4 changes: 2 additions & 2 deletions src/Runner/Cli.hs
Expand Up @@ -9,7 +9,7 @@ import Distribution.Nixpkgs.Haskell.Stack
import Distribution.System as System
import qualified Distribution.Text as Text
import Options.Applicative as Opts
import Paths_stack2nix ( version )
import Paths_stackage2nix ( version )
import Stack.Types
import System.Environment
import System.FilePath
Expand Down Expand Up @@ -70,7 +70,7 @@ pinfo = info
<*> infoOption ("stackage2nix " ++ Text.display version) (long "version" <> help "Show version")
<*> options )
( fullDesc
<> header "stack2nix converts Stack files into build instructions for Nix." )
<> header "stackage2nix converts Stack files into build instructions for Nix." )

nixpkgsRepository :: Parser FilePath
nixpkgsRepository = option str
Expand Down
9 changes: 5 additions & 4 deletions stack2nix-test → stackage2nix-test
Expand Up @@ -2,8 +2,9 @@

set -e

LTS_HASKELL_DIR=${LTS_HASKELL_DIR:-~/lts-haskell}
ALL_CABAL_HASHES_DIR=${ALL_CABAL_HASHES_DIR:-~/all-cabal-hashes}
STACKAGE2NIX_WORK_DIR=${STACKAGE2NIX_WORK_DIR:-$HOME}
LTS_HASKELL_DIR=${LTS_HASKELL_DIR:-$STACKAGE2NIX_WORK_DIR/lts-haskell}
ALL_CABAL_HASHES_DIR=${ALL_CABAL_HASHES_DIR:-$STACKAGE2NIX_WORK_DIR/all-cabal-hashes}

if [ ! -d "$LTS_HASKELL_DIR" ]; then
git clone --depth 1 https://github.com/fpco/lts-haskell.git "$LTS_HASKELL_DIR"
Expand All @@ -14,9 +15,9 @@ if [ ! -d "$ALL_CABAL_HASHES_DIR" ]; then
fi

set -x
stack exec -- stack2nix \
stack exec -- stackage2nix \
--lts-haskell "$LTS_HASKELL_DIR" \
--all-cabal-hashes "$ALL_CABAL_HASHES_DIR" \
.

nix-build -A stack2nix "$@"
nix-build -A stackage2nix "$@"
17 changes: 9 additions & 8 deletions stack2nix.cabal → stackage2nix.cabal
@@ -1,10 +1,11 @@
name: stack2nix
name: stackage2nix
version: 0.2.0
synopsis: Convert Stack files into Nix build instructions.
homepage: https://github.com/4e6/stack2nix#readme
homepage: https://github.com/4e6/stackage2nix#readme
license: BSD3
license-file: LICENSE
author: Dmitry Bushev
, Benno Fünfstück
maintainer: bushevdv@gmail.com
category: Distribution, Nix
build-type: Simple
Expand All @@ -27,7 +28,7 @@ library
, Stack.Types
other-modules: AllCabalHashes
, LtsHaskell
, Paths_stack2nix
, Paths_stackage2nix
build-depends: base > 4.7 && < 5
, Cabal > 1.24
, QuickCheck
Expand Down Expand Up @@ -58,12 +59,12 @@ library
default-language: Haskell2010
ghc-options: -Wall -funbox-strict-fields

executable stack2nix
hs-source-dirs: stack2nix
executable stackage2nix
hs-source-dirs: stackage2nix
main-is: Main.hs
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends: base
, stack2nix
, stackage2nix
default-language: Haskell2010

test-suite spec
Expand All @@ -76,7 +77,7 @@ test-suite spec
, hspec
, pretty
, shakespeare
, stack2nix
, stackage2nix
, text
, yaml
default-extensions: OverloadedStrings
Expand All @@ -88,4 +89,4 @@ test-suite spec

source-repository head
type: git
location: https://github.com/4e6/stack2nix
location: https://github.com/4e6/stackage2nix
File renamed without changes.

0 comments on commit 064625a

Please sign in to comment.