Simplify Nix expressions
This uses `developPackage` from `nixpkgs` to generate the derivation Also add CI for nix buildpull/329/head
parent
1b74b4274c
commit
0b0c6d65ca
|
@ -56,3 +56,11 @@ jobs:
|
|||
path: dist-newstyle/sdist/brittany-*.tar.gz
|
||||
name: brittany-${{ github.sha }}.tar.gz
|
||||
- run: cabal check
|
||||
|
||||
|
||||
nix:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: cachix/install-nix-action@v12
|
||||
- uses: actions/checkout@v2
|
||||
- run: nix-build
|
||||
|
|
16
README.md
16
README.md
|
@ -70,7 +70,7 @@ log the size of the input, but _not_ the full input/output of requests.)
|
|||
|
||||
- via `nix`:
|
||||
~~~.sh
|
||||
nix build -f release.nix # or 'nix-build -f release.nix'
|
||||
nix build
|
||||
nix-env -i ./result
|
||||
~~~
|
||||
|
||||
|
@ -102,6 +102,20 @@ log the size of the input, but _not_ the full input/output of requests.)
|
|||
aura -A brittany
|
||||
~~~~
|
||||
|
||||
# Development tips
|
||||
|
||||
## Run a hoogle server
|
||||
|
||||
To host a local Hoogle server with all of Brittany's dependencies run:
|
||||
|
||||
```sh
|
||||
echo brittany.cabal |
|
||||
$(nix-build '<nixpkgs>' --no-link -A entr)/bin/entr -r -- \
|
||||
sh -c "nix-shell --run 'hoogle server --local'"
|
||||
```
|
||||
|
||||
This will watch `brittany.cabal` for changes and restart the server when new dependencies are added there.
|
||||
|
||||
# Editor Integration
|
||||
|
||||
#### Sublime text
|
||||
|
|
52
default.nix
52
default.nix
|
@ -1,38 +1,18 @@
|
|||
{ 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
|
||||
{ nixpkgsSrc ? builtins.fetchTarball {
|
||||
url =
|
||||
"https://github.com/nixos/nixpkgs/archive/069f183f16c3ea5d4b6e7625433b92eba77534f7.tar.gz"; # nixos-unstable
|
||||
sha256 = "1by9rqvr2k6iz2yipf89yaj254yicpwq384ijgyy8p71lfxbbww2";
|
||||
}, pkgs ? import nixpkgsSrc { }, compiler ? null, forShell ? pkgs.lib.inNixShell
|
||||
}:
|
||||
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;
|
||||
|
||||
let
|
||||
haskellPackages = if compiler == null then
|
||||
pkgs.haskellPackages
|
||||
else
|
||||
pkgs.haskell.packages.${compiler};
|
||||
|
||||
in haskellPackages.developPackage {
|
||||
name = "brittany";
|
||||
root = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
|
||||
returnShellEnv = forShell;
|
||||
}
|
||||
|
|
5
pkgs.nix
5
pkgs.nix
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
url = "https://github.com/nixos/nixpkgs.git";
|
||||
ref = "release-18.09";
|
||||
rev = "b9fa31cea0e119ecf1867af4944ddc2f7633aacd";
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{ pkgs ? import (fetchGit (import ./pkgs.nix)) {}
|
||||
, compiler ? "ghc822"
|
||||
}:
|
||||
|
||||
pkgs.haskell.packages.${compiler}.callPackage ./shell.nix {}
|
13
shell.nix
13
shell.nix
|
@ -1,13 +0,0 @@
|
|||
{ 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";
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue