1
1
mirror of https://github.com/nmattia/niv.git synced 2024-09-07 13:05:39 +03:00

Replace snack with cabal

This commit is contained in:
Nicolas Mattia 2019-04-05 11:43:57 +02:00
parent 45041fa765
commit 262dd9ab21
8 changed files with 44 additions and 28 deletions

View File

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

View File

@ -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:

View File

@ -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:

View File

@ -6,8 +6,6 @@
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}
module Main (main) where
import Control.Applicative
import Control.Monad
import Control.Monad.State

View File

@ -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;

View File

@ -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",

View File

@ -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

View File

@ -1,4 +1,2 @@
with { pkgs = import ./nix {}; };
pkgs.mkShell
{ buildInputs = [ pkgs.snack-exe ];
}
{ pkgs ? import ./nix {} }:
(import ./default.nix { inherit pkgs; }).niv-devshell