Simplify Nix expressions
This uses `developPackage` from `nixpkgs` to generate the derivation Also add CI for nix buildpull/326/head
parent
7dedb0c17d
commit
8b588af8ef
|
@ -56,3 +56,11 @@ jobs:
|
||||||
path: dist-newstyle/sdist/brittany-*.tar.gz
|
path: dist-newstyle/sdist/brittany-*.tar.gz
|
||||||
name: brittany-${{ github.sha }}.tar.gz
|
name: brittany-${{ github.sha }}.tar.gz
|
||||||
- run: cabal check
|
- 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`:
|
- via `nix`:
|
||||||
~~~.sh
|
~~~.sh
|
||||||
nix build -f release.nix # or 'nix-build -f release.nix'
|
nix build
|
||||||
nix-env -i ./result
|
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
|
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
|
# Editor Integration
|
||||||
|
|
||||||
#### Sublime text
|
#### Sublime text
|
||||||
|
|
52
default.nix
52
default.nix
|
@ -1,38 +1,18 @@
|
||||||
{ mkDerivation, aeson, base, butcher, bytestring, cmdargs
|
{ nixpkgsSrc ? builtins.fetchTarball {
|
||||||
, containers, czipwith, data-tree-print, deepseq, directory, extra
|
url =
|
||||||
, filepath, ghc, ghc-boot-th, ghc-exactprint, ghc-paths, hspec
|
"https://github.com/nixos/nixpkgs/archive/069f183f16c3ea5d4b6e7625433b92eba77534f7.tar.gz"; # nixos-unstable
|
||||||
, monad-memo, mtl, multistate, neat-interpolation, parsec, pretty
|
sha256 = "1by9rqvr2k6iz2yipf89yaj254yicpwq384ijgyy8p71lfxbbww2";
|
||||||
, random, safe, semigroups, stdenv, strict, syb, text, transformers
|
}, pkgs ? import nixpkgsSrc { }, compiler ? null, forShell ? pkgs.lib.inNixShell
|
||||||
, uniplate, unsafe, yaml
|
|
||||||
}:
|
}:
|
||||||
mkDerivation {
|
|
||||||
pname = "brittany";
|
let
|
||||||
version = "0.11.0.0";
|
haskellPackages = if compiler == null then
|
||||||
src = ./.;
|
pkgs.haskellPackages
|
||||||
isLibrary = true;
|
else
|
||||||
isExecutable = true;
|
pkgs.haskell.packages.${compiler};
|
||||||
libraryHaskellDepends = [
|
|
||||||
aeson base butcher bytestring cmdargs containers czipwith
|
in haskellPackages.developPackage {
|
||||||
data-tree-print deepseq directory extra filepath ghc ghc-boot-th
|
name = "";
|
||||||
ghc-exactprint ghc-paths monad-memo mtl multistate
|
root = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
|
||||||
neat-interpolation pretty random safe semigroups strict syb text
|
returnShellEnv = forShell;
|
||||||
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
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