mirror of
https://github.com/coot/free-category.git
synced 2024-11-26 21:33:47 +03:00
Use callCabal2nix
This commit is contained in:
parent
2cc5f7ac38
commit
7efa4c4430
28
default.nix
28
default.nix
@ -10,6 +10,7 @@ let
|
|||||||
|
|
||||||
pkgs = nixpkgs.haskell.packages;
|
pkgs = nixpkgs.haskell.packages;
|
||||||
lib = nixpkgs.haskell.lib;
|
lib = nixpkgs.haskell.lib;
|
||||||
|
callCabal2nix = nixpkgs.haskell.packages.${compiler}.callCabal2nix;
|
||||||
|
|
||||||
doHaddock = if haddock
|
doHaddock = if haddock
|
||||||
then lib.doHaddock
|
then lib.doHaddock
|
||||||
@ -23,12 +24,23 @@ let
|
|||||||
doDev = if dev
|
doDev = if dev
|
||||||
then drv: lib.appendConfigureFlag drv "--ghc-option -Werror"
|
then drv: lib.appendConfigureFlag drv "--ghc-option -Werror"
|
||||||
else nixpkgs.lib.id;
|
else nixpkgs.lib.id;
|
||||||
|
docNoSeprateOutput = drv: lib.overrideCabal drv (drv: { enableSeparateDocOutput = false; });
|
||||||
free-category = doDev(doHaddock(doTest(doBench(
|
srcFilter = src: path: type:
|
||||||
pkgs.${compiler}.callPackage ./pkg.nix
|
let relPath = nixpkgs.lib.removePrefix (toString src + "/") (toString path);
|
||||||
{ inherit nixpkgs; }))));
|
|
||||||
examples = doDev(doHaddock(doTest(doBench(
|
|
||||||
pkgs.${compiler}.callPackage ./examples/pkg.nix
|
|
||||||
{ inherit free-category nixpkgs; }))));
|
|
||||||
in
|
in
|
||||||
{ inherit free-category examples; }
|
nixpkgs.lib.hasPrefix "src" relPath
|
||||||
|
|| nixpkgs.lib.hasPrefix "test" relPath
|
||||||
|
|| nixpkgs.lib.any
|
||||||
|
(a: a == relPath)
|
||||||
|
[ "Setup.hs" "cabal.project" "ChangeLog.md" "free-category.cabal" "LICENSE"];
|
||||||
|
|
||||||
|
free-category = docNoSeprateOutput(doDev(doHaddock(doTest(doBench(
|
||||||
|
lib.overrideCabal (callCabal2nix "free-category" ./. {})
|
||||||
|
(drv: {src = nixpkgs.lib.cleanSourceWith { filter = srcFilter drv.src; src = drv.src; };})
|
||||||
|
)))));
|
||||||
|
examples = docNoSeprateOutput(doDev(doHaddock(doTest(doBench(
|
||||||
|
lib.overrideCabal (callCabal2nix "examples" ./examples { inherit free-category; })
|
||||||
|
(drv: {src = nixpkgs.lib.sourceFilesBySuffices drv.src [ ".hs" "LICENSE" "ChangeLog.md" "examples.cabal" ];})
|
||||||
|
)))));
|
||||||
|
|
||||||
|
in { inherit free-category examples; }
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
{ nixpkgs
|
|
||||||
, mkDerivation
|
|
||||||
, base
|
|
||||||
, free-category
|
|
||||||
, free-algebras
|
|
||||||
, QuickCheck
|
|
||||||
, stdenv
|
|
||||||
}:
|
|
||||||
mkDerivation {
|
|
||||||
pname = "free-category-examples";
|
|
||||||
version = "0.0.1.0";
|
|
||||||
src = nixpkgs.lib.sourceFilesBySuffices ./.
|
|
||||||
[ ".hs" "LICENSE" "ChangeLog.md" "examples.cabal" ];
|
|
||||||
libraryHaskellDepends = [
|
|
||||||
base
|
|
||||||
free-category
|
|
||||||
free-algebras
|
|
||||||
QuickCheck
|
|
||||||
];
|
|
||||||
libraryToolDepends = [ ];
|
|
||||||
license = stdenv.lib.licenses.mpl20;
|
|
||||||
enableSeparateDocOutput = false;
|
|
||||||
}
|
|
33
pkg.nix
33
pkg.nix
@ -1,33 +0,0 @@
|
|||||||
{ mkDerivation
|
|
||||||
, nixpkgs
|
|
||||||
, stdenv
|
|
||||||
, base
|
|
||||||
, free-algebras
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
lib = nixpkgs.lib;
|
|
||||||
srcFilter = src: path: type:
|
|
||||||
let relPath = lib.removePrefix (toString src + "/") (toString path);
|
|
||||||
in
|
|
||||||
lib.hasPrefix "src" relPath
|
|
||||||
|| lib.hasPrefix "test" relPath
|
|
||||||
|| lib.any
|
|
||||||
(a: a == relPath)
|
|
||||||
[ "Setup.hs" "cabal.project" "ChangeLog.md" "free-category.cabal" "LICENSE"];
|
|
||||||
in
|
|
||||||
mkDerivation {
|
|
||||||
pname = "free-category";
|
|
||||||
version = "0.0.1.0";
|
|
||||||
src = lib.cleanSourceWith { filter = srcFilter ./.; src = ./.; };
|
|
||||||
libraryHaskellDepends = [
|
|
||||||
base
|
|
||||||
free-algebras
|
|
||||||
];
|
|
||||||
libraryToolDepends = [ ];
|
|
||||||
testHaskellDepends = [
|
|
||||||
base
|
|
||||||
];
|
|
||||||
homepage = "https://github.com/coot/free-algebras#readme";
|
|
||||||
license = stdenv.lib.licenses.mpl20;
|
|
||||||
enableSeparateDocOutput = false;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user