mirror of
https://github.com/polysemy-research/polysemy.git
synced 2024-10-05 14:38:06 +03:00
add basic nix build
This commit is contained in:
parent
c37d485b61
commit
b8b912afae
18
.github/workflows/nix-build.yml
vendored
Normal file
18
.github/workflows/nix-build.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
name: Build Polysemy with Nix
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- nix-build
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: cachix/install-nix-action@v12
|
||||
with:
|
||||
install_url: https://github.com/numtide/nix-flakes-installer/releases/download/nix-2.4pre20201221_9fab14a/install
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
- run: nix flake check
|
45
README.md
45
README.md
@ -220,6 +220,50 @@ You're going to want to stick all of this into your `package.yaml` file.
|
||||
- TypeFamilies
|
||||
```
|
||||
|
||||
## Building with Nix
|
||||
|
||||
The project provides a basic nix config for building in development.
|
||||
It is defined as a [flake] with backwards compatibility stubs in `default.nix` and `shell.nix`.
|
||||
|
||||
To build the main library or plugin:
|
||||
|
||||
```bash
|
||||
nix-build -A polysemy
|
||||
nix-build -A polysemy-plugin
|
||||
```
|
||||
|
||||
Flake version:
|
||||
|
||||
```bash
|
||||
nix build
|
||||
nix build '.#polysemy-plugin'
|
||||
```
|
||||
|
||||
To inspect a dependency:
|
||||
|
||||
```bash
|
||||
nix repl
|
||||
|
||||
> p = import ./.
|
||||
> p.unagi-chan
|
||||
```
|
||||
|
||||
To run a shell command with all dependencies in the environment:
|
||||
|
||||
```bash
|
||||
nix-shell --pure
|
||||
nix-shell --pure --run 'cabal v2-haddock polysemy'
|
||||
nix-shell --pure --run ghcid
|
||||
```
|
||||
|
||||
Flake version:
|
||||
|
||||
```bash
|
||||
nix develop -i # just enter a shell
|
||||
nix develop -i -c cabal v2-haddock polysemy
|
||||
nix develop -i -c haskell-language-server-wrapper # start HLS for your IDE
|
||||
```
|
||||
|
||||
## *What about performance?* ([TL;DR](#tldr))
|
||||
|
||||
Previous versions of this `README` mentioned **the library being**
|
||||
@ -311,3 +355,4 @@ implementation:
|
||||
[oleg:more]: http://okmij.org/ftp/Haskell/extensible/more.pdf
|
||||
[schrijvers:fusion]: https://people.cs.kuleuven.be/~tom.schrijvers/Research/papers/mpc2015.pdf
|
||||
[wu:scope]: https://www.cs.ox.ac.uk/people/nicolas.wu/papers/Scope.pdf
|
||||
[flake]: https://nixos.wiki/wiki/Flakes
|
||||
|
1
default.nix
Normal file
1
default.nix
Normal file
@ -0,0 +1 @@
|
||||
{...}: (import ./nix/compat.nix).defaultNix
|
43
flake.lock
Normal file
43
flake.lock
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1614513358,
|
||||
"narHash": "sha256-LakhOx3S1dRjnh0b5Dg3mbZyH0ToC9I8Y2wKSkBaTzU=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5466c5bbece17adaab2d82fae80b46e807611bf3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1615483480,
|
||||
"narHash": "sha256-Y5Bg5WXZf/jpfb0XTgsunt8GwtPXZhT7Ka3MNnA4IdQ=",
|
||||
"owner": "NixOs",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6be212cce73f4ce4f65375fbdebcf0b87b182bc0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOs",
|
||||
"ref": "nixos-20.09",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
37
flake.nix
Normal file
37
flake.nix
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
description = "Higher-order, low-boilerplate free monads.";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = github:NixOs/nixpkgs/nixos-20.09;
|
||||
flake-utils.url = github:numtide/flake-utils;
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachSystem ["x86_64-linux"] (system:
|
||||
let
|
||||
overlay = import ./nix/overlay.nix;
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [overlay];
|
||||
};
|
||||
in {
|
||||
packages = { inherit (pkgs.haskellPackages) polysemy polysemy-plugin; };
|
||||
|
||||
defaultPackage = pkgs.haskellPackages.polysemy;
|
||||
|
||||
devShell = pkgs.haskellPackages.shellFor {
|
||||
packages = _: [];
|
||||
buildInputs = with pkgs.haskellPackages; [
|
||||
cabal-install
|
||||
haskell-language-server
|
||||
ghcid
|
||||
];
|
||||
withHoogle = true;
|
||||
};
|
||||
|
||||
checks = {
|
||||
inherit (pkgs.haskellPackages) polysemy polysemy-plugin;
|
||||
};
|
||||
});
|
||||
}
|
13
hie.yaml
Normal file
13
hie.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
cradle:
|
||||
cabal:
|
||||
- path: "."
|
||||
component: "lib:polysemy"
|
||||
|
||||
- path: "./test"
|
||||
component: "polysemy:test:polysemy-test"
|
||||
|
||||
- path: "./polysemy-plugin"
|
||||
component: "lib:polysemy-plugin"
|
||||
|
||||
- path: "./polysemy-plugin/test"
|
||||
component: "polysemy-plugin:test:polysemy-plugin-test"
|
7
nix/compat.nix
Normal file
7
nix/compat.nix
Normal file
@ -0,0 +1,7 @@
|
||||
let
|
||||
compat = fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
|
||||
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2";
|
||||
};
|
||||
in
|
||||
import compat { src = ../.; }
|
33
nix/overlay.nix
Normal file
33
nix/overlay.nix
Normal file
@ -0,0 +1,33 @@
|
||||
let
|
||||
pkgOverrides = pkgs: self: super:
|
||||
let
|
||||
filter = pkgs.nix-gitignore.gitignoreSourcePure [./source-filter];
|
||||
c2n = name: src: self.callCabal2nixWithOptions name (filter src) "" {};
|
||||
hackage = pkg: ver: sha256: self.callHackageDirect { inherit pkg ver sha256; } {};
|
||||
in {
|
||||
polysemy = c2n "polysemy" ../.;
|
||||
polysemy-plugin = c2n "polysemy-plugin" ../polysemy-plugin;
|
||||
first-class-families =
|
||||
hackage "first-class-families" "0.8.0.1" "0h1rxbc7zsxrlhx5xcl58wjx3qi2wny8wb3sk7c1qnydf4ckcckz";
|
||||
ghc-lib = hackage "ghc-lib" "0.20190204" "1i2zjlr30bxpabsm8f995x455v847gbpzczm2w4089fqmsnzpzfd";
|
||||
dump-core = hackage "dump-core" "0.1.3.2" "1mi8p736yn00z549pwnjv4ydwbs8mwg6dla3ly447c027nq8py6g";
|
||||
monadLib = hackage "monadLib" "3.10" "1v4ynjcb963s3lfw3v71qdzvld1mmz1faf8swhvicma5jbvwchy2";
|
||||
};
|
||||
in
|
||||
self: super: {
|
||||
haskell = super.haskell // (
|
||||
let
|
||||
p = super.haskell.packages;
|
||||
overrides = pkgOverrides self;
|
||||
in {
|
||||
packages = p // {
|
||||
ghc865 = p.ghc865.override { inherit overrides; };
|
||||
ghc883 = p.ghc883.override { inherit overrides; };
|
||||
ghc884 = p.ghc884.override { inherit overrides; };
|
||||
ghc8101 = p.ghc8101.override { inherit overrides; };
|
||||
ghc8102 = p.ghc8102.override { inherit overrides; };
|
||||
};
|
||||
}
|
||||
);
|
||||
haskellPackages = self.haskell.packages.ghc884;
|
||||
}
|
11
nix/source-filter
Normal file
11
nix/source-filter
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
.*
|
||||
!*.cabal
|
||||
!*.nix
|
||||
!*.hs
|
||||
!LICENSE
|
||||
!/flake.lock
|
||||
!/nix/
|
||||
!/src/
|
||||
!/test/
|
||||
!/bench/
|
@ -1,10 +1,8 @@
|
||||
cabal-version: 2.0
|
||||
|
||||
-- This file has been generated from package.yaml by hpack version 0.33.0.
|
||||
-- This file has been generated from package.yaml by hpack version 0.34.4.
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 0e9b200907c62e6df486f7512ceffff92f0941cf55d6ef49a581324d50201d44
|
||||
|
||||
name: polysemy-plugin
|
||||
version: 0.2.5.2
|
||||
@ -51,14 +49,27 @@ library
|
||||
Paths_polysemy_plugin
|
||||
hs-source-dirs:
|
||||
src
|
||||
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
|
||||
default-extensions:
|
||||
DataKinds
|
||||
DeriveFunctor
|
||||
FlexibleContexts
|
||||
GADTs
|
||||
LambdaCase
|
||||
PolyKinds
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
TypeApplications
|
||||
TypeOperators
|
||||
TypeFamilies
|
||||
UnicodeSyntax
|
||||
build-depends:
|
||||
base >=4.9 && <5
|
||||
, containers >=0.5 && <0.7
|
||||
, ghc >=8.4.4 && <9
|
||||
, ghc-tcplugins-extra >=0.3 && <0.5
|
||||
, polysemy >=1.3
|
||||
, syb >=0.7 && <0.8
|
||||
, syb ==0.7.*
|
||||
, transformers >=0.5.2.0 && <0.6
|
||||
default-language: Haskell2010
|
||||
|
||||
@ -80,7 +91,20 @@ test-suite polysemy-plugin-test
|
||||
Build_doctests
|
||||
hs-source-dirs:
|
||||
test
|
||||
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
|
||||
default-extensions:
|
||||
DataKinds
|
||||
DeriveFunctor
|
||||
FlexibleContexts
|
||||
GADTs
|
||||
LambdaCase
|
||||
PolyKinds
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
TypeApplications
|
||||
TypeOperators
|
||||
TypeFamilies
|
||||
UnicodeSyntax
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N -fplugin=Polysemy.Plugin
|
||||
build-tool-depends:
|
||||
hspec-discover:hspec-discover
|
||||
@ -95,7 +119,7 @@ test-suite polysemy-plugin-test
|
||||
, polysemy >=1.3.0.0
|
||||
, polysemy-plugin
|
||||
, should-not-typecheck >=2.1.0 && <3
|
||||
, syb >=0.7 && <0.8
|
||||
, syb ==0.7.*
|
||||
, transformers >=0.5.2.0 && <0.6
|
||||
if flag(corelint)
|
||||
ghc-options: -dcore-lint -dsuppress-all
|
||||
|
@ -1,10 +1,8 @@
|
||||
cabal-version: 2.0
|
||||
|
||||
-- This file has been generated from package.yaml by hpack version 0.33.0.
|
||||
-- This file has been generated from package.yaml by hpack version 0.34.4.
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 9d61a6c298262f3e765c48ccc01f30cd9c328104777970c3529931c4d5c4ca22
|
||||
|
||||
name: polysemy
|
||||
version: 1.4.0.0
|
||||
@ -92,7 +90,20 @@ library
|
||||
Paths_polysemy
|
||||
hs-source-dirs:
|
||||
src
|
||||
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
|
||||
default-extensions:
|
||||
DataKinds
|
||||
DeriveFunctor
|
||||
FlexibleContexts
|
||||
GADTs
|
||||
LambdaCase
|
||||
PolyKinds
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
TypeApplications
|
||||
TypeOperators
|
||||
TypeFamilies
|
||||
UnicodeSyntax
|
||||
ghc-options: -Wall
|
||||
build-depends:
|
||||
QuickCheck >=2.11.3 && <3
|
||||
@ -101,8 +112,8 @@ library
|
||||
, containers >=0.5 && <0.7
|
||||
, first-class-families >=0.5.0.0 && <0.9
|
||||
, mtl >=2.2.2 && <3
|
||||
, stm >=2 && <3
|
||||
, syb >=0.7 && <0.8
|
||||
, stm ==2.*
|
||||
, syb ==0.7.*
|
||||
, template-haskell >=2.12.0.0 && <3
|
||||
, th-abstraction >=0.3.1.0 && <0.5
|
||||
, transformers >=0.5.2.0 && <0.6
|
||||
@ -110,7 +121,9 @@ library
|
||||
, type-errors-pretty >=0.0.0.0 && <0.1
|
||||
, unagi-chan >=0.4.0.0 && <0.5
|
||||
if impl(ghc < 8.6)
|
||||
default-extensions: MonadFailDesugaring TypeInType
|
||||
default-extensions:
|
||||
MonadFailDesugaring
|
||||
TypeInType
|
||||
if flag(dump-core)
|
||||
ghc-options: -fplugin=DumpCore -fplugin-opt=DumpCore:core-html
|
||||
build-depends:
|
||||
@ -154,7 +167,20 @@ test-suite polysemy-test
|
||||
Build_doctests
|
||||
hs-source-dirs:
|
||||
test
|
||||
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
|
||||
default-extensions:
|
||||
DataKinds
|
||||
DeriveFunctor
|
||||
FlexibleContexts
|
||||
GADTs
|
||||
LambdaCase
|
||||
PolyKinds
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
TypeApplications
|
||||
TypeOperators
|
||||
TypeFamilies
|
||||
UnicodeSyntax
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
build-tool-depends:
|
||||
hspec-discover:hspec-discover >=2.0
|
||||
@ -169,8 +195,8 @@ test-suite polysemy-test
|
||||
, inspection-testing >=0.4.2 && <0.5
|
||||
, mtl >=2.2.2 && <3
|
||||
, polysemy
|
||||
, stm >=2 && <3
|
||||
, syb >=0.7 && <0.8
|
||||
, stm ==2.*
|
||||
, syb ==0.7.*
|
||||
, template-haskell >=2.12.0.0 && <3
|
||||
, th-abstraction >=0.3.1.0 && <0.5
|
||||
, transformers >=0.5.2.0 && <0.6
|
||||
@ -178,7 +204,9 @@ test-suite polysemy-test
|
||||
, type-errors-pretty >=0.0.0.0 && <0.1
|
||||
, unagi-chan >=0.4.0.0 && <0.5
|
||||
if impl(ghc < 8.6)
|
||||
default-extensions: MonadFailDesugaring TypeInType
|
||||
default-extensions:
|
||||
MonadFailDesugaring
|
||||
TypeInType
|
||||
default-language: Haskell2010
|
||||
|
||||
benchmark polysemy-bench
|
||||
@ -189,7 +217,20 @@ benchmark polysemy-bench
|
||||
Paths_polysemy
|
||||
hs-source-dirs:
|
||||
bench
|
||||
default-extensions: DataKinds DeriveFunctor FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables StandaloneDeriving TypeApplications TypeOperators TypeFamilies UnicodeSyntax
|
||||
default-extensions:
|
||||
DataKinds
|
||||
DeriveFunctor
|
||||
FlexibleContexts
|
||||
GADTs
|
||||
LambdaCase
|
||||
PolyKinds
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
TypeApplications
|
||||
TypeOperators
|
||||
TypeFamilies
|
||||
UnicodeSyntax
|
||||
build-depends:
|
||||
QuickCheck >=2.11.3 && <3
|
||||
, async >=2.2 && <3
|
||||
@ -201,8 +242,8 @@ benchmark polysemy-bench
|
||||
, freer-simple
|
||||
, mtl
|
||||
, polysemy
|
||||
, stm >=2 && <3
|
||||
, syb >=0.7 && <0.8
|
||||
, stm ==2.*
|
||||
, syb ==0.7.*
|
||||
, template-haskell >=2.12.0.0 && <3
|
||||
, th-abstraction >=0.3.1.0 && <0.5
|
||||
, transformers >=0.5.2.0 && <0.6
|
||||
@ -210,5 +251,7 @@ benchmark polysemy-bench
|
||||
, type-errors-pretty >=0.0.0.0 && <0.1
|
||||
, unagi-chan >=0.4.0.0 && <0.5
|
||||
if impl(ghc < 8.6)
|
||||
default-extensions: MonadFailDesugaring TypeInType
|
||||
default-extensions:
|
||||
MonadFailDesugaring
|
||||
TypeInType
|
||||
default-language: Haskell2010
|
||||
|
Loading…
Reference in New Issue
Block a user