Refactor nix expressions

This way, the default.nix file can be imported to other projects. In order to
build brittany, we now need to do `nix build -f release.nix`, which will
pull in the version overrides from shell.nix.
pull/213/head
Ben Sima 2019-01-29 14:01:29 -08:00
parent f68fbb3118
commit e67a46f264
4 changed files with 55 additions and 12 deletions

View File

@ -96,7 +96,7 @@ log the size of the input, but _not_ the full input/output of requests.)
- via `nix`:
~~~.sh
nix build # or 'nix-build'
nix build -f release.nix # or 'nix-build -f release.nix'
nix-env -i ./result
~~~

View File

@ -1,13 +1,38 @@
{ pkgs ? import (fetchGit (import ./pkgs.nix)) {}
, compiler ? "ghc822"
{ mkDerivation, aeson, base, butcher, bytestring, cmdargs
, containers, czipwith, data-tree-print, deepseq, directory, extra
, filepath, ghc, ghc-boot-th, ghc-exactprint, ghc-paths, hspec
, monad-memo, mtl, multistate, neat-interpolation, parsec, pretty
, random, safe, semigroups, stdenv, strict, syb, text, transformers
, uniplate, unsafe, yaml
}:
pkgs.haskell.packages.${compiler}.developPackage {
root = ./.;
name = "brittany";
overrides = with pkgs.haskell.lib; self: super: {
};
source-overrides = {
ghc-exactprint = "0.5.8.0";
};
mkDerivation {
pname = "brittany";
version = "0.11.0.0";
src = ./.;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [
aeson base butcher bytestring cmdargs containers czipwith
data-tree-print deepseq directory extra filepath ghc ghc-boot-th
ghc-exactprint ghc-paths monad-memo mtl multistate
neat-interpolation pretty random safe semigroups strict syb text
transformers uniplate unsafe yaml
];
executableHaskellDepends = [
aeson base butcher bytestring cmdargs containers czipwith
data-tree-print deepseq directory extra filepath ghc ghc-boot-th
ghc-exactprint ghc-paths monad-memo mtl multistate
neat-interpolation pretty safe semigroups strict syb text
transformers uniplate unsafe yaml
];
testHaskellDepends = [
aeson base butcher bytestring cmdargs containers czipwith
data-tree-print deepseq directory extra filepath ghc ghc-boot-th
ghc-exactprint ghc-paths hspec monad-memo mtl multistate
neat-interpolation parsec pretty safe semigroups strict syb text
transformers uniplate unsafe yaml
];
homepage = "https://github.com/lspitzner/brittany/";
description = "Haskell source code formatter";
license = stdenv.lib.licenses.agpl3;
}

5
release.nix Normal file
View File

@ -0,0 +1,5 @@
{ pkgs ? import (fetchGit (import ./pkgs.nix)) {}
, compiler ? "ghc822"
}:
pkgs.haskell.packages.${compiler}.callPackage ./shell.nix {}

13
shell.nix Normal file
View File

@ -0,0 +1,13 @@
{ pkgs ? import (fetchGit (import ./pkgs.nix)) {}
, compiler ? "ghc822"
}:
pkgs.haskell.packages.${compiler}.developPackage {
root = ./.;
name = "brittany";
overrides = with pkgs.haskell.lib; self: super: {
};
source-overrides = {
ghc-exactprint = "0.5.8.0";
};
}