Skip to content
Permalink
Browse files

Replace snack with cabal

  • Loading branch information...
nmattia committed Apr 5, 2019
1 parent 45041fa commit 262dd9ab218a51e781eebd8593d8a9c6002d473f
Showing with 44 additions and 28 deletions.
  1. +6 −0 .circleci/config.yml
  2. +1 −4 README.md
  3. +1 −4 README.tpl.md
  4. +0 −2 Main.hs → app/Niv.hs
  5. +26 −1 default.nix
  6. +0 −11 nix/sources.json
  7. +8 −2 package.yaml
  8. +2 −4 shell.nix
@@ -23,6 +23,12 @@ jobs:
echo "keep-outputs = true" | sudo tee -a /etc/nix/nix.conf
echo "keep-derivations = true" | sudo tee -a /etc/nix/nix.conf
# Set a new TMP because /run/user is (1) pretty small and (2)
# mounted with noexec
new_tmp=$HOME/tmp
mkdir -p $new_tmp
echo "export TMPDIR=$new_tmp" >> $BASH_ENV
# Builds everything from scratch on master. On a branch the branch's
# cache is used if it exists, otherwise the latest cache generated from
# master is used.
@@ -16,10 +16,7 @@ $ nix-env -iA niv -f https://github.com/nmattia/niv/tarball/master
Inside the provided nix shell:

``` bash
$ # GHCi:
$ snack ghci
$ # run:
$ snack run -- <args>
$ repl
```

Run the test suite with this command:
@@ -16,10 +16,7 @@ $ nix-env -iA niv -f https://github.com/nmattia/niv/tarball/master
Inside the provided nix shell:

``` bash
$ # GHCi:
$ snack ghci
$ # run:
$ snack run -- <args>
$ repl
```

Run the test suite with this command:
@@ -6,8 +6,6 @@
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}

module Main (main) where

import Control.Applicative
import Control.Monad
import Control.Monad.State
@@ -1,6 +1,31 @@
{ pkgs ? import ./nix {} }:
with rec
{ niv-source = pkgs.lib.sourceByRegex ./.
[ "^package.yaml$"
"^app.*$"
"^README.md$"
];
haskellPackages = pkgs.haskellPackages.override
{ overrides = _: haskellPackages:
{ niv = haskellPackages.callCabal2nix "niv" niv-source {}; };
};

niv-devshell = haskellPackages.shellFor
{ packages = (ps: [ ps.niv ]);
shellHook =
''
repl() {
ghci Main.hs
}
echo "To start a REPL session, run:"
echo " > repl"
'';
};
};
rec
{ niv = pkgs.snack-lib.executable ./package.yaml;
{ inherit niv-source niv-devshell;
inherit (haskellPackages) niv;
readme = pkgs.writeText "README.md"
(with
{ template = builtins.readFile ./README.tpl.md;
@@ -1,15 +1,4 @@
{
"snack": {
"homepage": "",
"url": "https://github.com/nmattia/snack/archive/7b90144a01fff7e5eeb520a6b774377f75e44205.tar.gz",
"owner": "nmattia",
"branch": "master",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"repo": "snack",
"sha256": "0p0bldlr83i4bigsv0ygnn7q0lv25hkjd5n4nm1vlvwm9cp8n5dn",
"description": "Nix-based incremental build tool for Haskell projects",
"rev": "7b90144a01fff7e5eeb520a6b774377f75e44205"
},
"nixpkgs": {
"url": "https://github.com/NixOS/nixpkgs-channels/archive/8e70d4bd7d5e1c137006fe483d8d116311694bc2.tar.gz",
"owner": "NixOS",
@@ -1,13 +1,19 @@
name: niv

license: MIT

ghc-options:
- -Wall
- -Werror

executable:
source-dirs: . # remove when https://github.com/nmattia/snack/pull/96 is merged
main: Main.hs
main: app/Niv.hs
dependencies:
- base
- hashable
- process
- text
- bytestring
- aeson
- aeson-pretty
- directory
@@ -1,4 +1,2 @@
with { pkgs = import ./nix {}; };
pkgs.mkShell
{ buildInputs = [ pkgs.snack-exe ];
}
{ pkgs ? import ./nix {} }:
(import ./default.nix { inherit pkgs; }).niv-devshell

0 comments on commit 262dd9a

Please sign in to comment.
You can’t perform that action at this time.