Compare commits

..

3 Commits

Author SHA1 Message Date
c45ea0ecc8 wip 2018-12-20 00:33:32 +02:00
6767813879 wip 2018-12-20 00:29:25 +02:00
8818b6f495 Separate backend and frontend 2018-12-19 23:18:13 +02:00
10 changed files with 91 additions and 38 deletions

View File

@ -8,5 +8,5 @@ before_script:
- mkdir -p ~/.config/nixpkgs - mkdir -p ~/.config/nixpkgs
script: script:
- nix-build ./release.nix --option trusted-public-keys "masser-ebook-manager.cachix.org-1:mtFSkQ2MO5MvjUpulZoFKjKUIa8g8CTcdPVuJaPKS1w= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --option binary-caches "https://cache.nixos.org https://masser-ebook-manager.cachix.org" -A ghc.backend -A ghc.frontend - nix-build ./release.nix --option trusted-public-keys "masser-ebook-manager.cachix.org-1:mtFSkQ2MO5MvjUpulZoFKjKUIa8g8CTcdPVuJaPKS1w= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --option binary-caches "https://masser-ebook-manager.cachix.org https://cache.nixos.org" -A ghc.backend -A ghc.frontend
- nix-build ./release.nix --option trusted-public-keys "masser-ebook-manager.cachix.org-1:mtFSkQ2MO5MvjUpulZoFKjKUIa8g8CTcdPVuJaPKS1w= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --option binary-caches "https://cache.nixos.org https://masser-ebook-manager.cachix.org" -A ghcjs.frontend - nix-build ./release.nix --option trusted-public-keys "masser-ebook-manager.cachix.org-1:mtFSkQ2MO5MvjUpulZoFKjKUIa8g8CTcdPVuJaPKS1w= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --option binary-caches "https://masser-ebook-manager.cachix.org https://cache.nixos.org" -A ghcjs.frontend

View File

@ -23,6 +23,7 @@ executable backend
, API.Catalogue , API.Catalogue
, API.Channels , API.Channels
, API.Users , API.Users
, Configuration
, Database , Database
, Database.Book , Database.Book
, Database.Channel , Database.Channel
@ -145,4 +146,4 @@ test-suite spec
default-extensions: DeriveGeneric default-extensions: DeriveGeneric
, NoImplicitPrelude , NoImplicitPrelude
, OverloadedStrings , OverloadedStrings
, RecordWildCards , RecordWildCards

View File

@ -23,3 +23,4 @@ data Config = Config { database :: Pg
instance Interpret Pg instance Interpret Pg
instance Interpret Store instance Interpret Store
instance Interpret Config instance Interpret Config

View File

@ -13,13 +13,10 @@ extra-source-files: ChangeLog.md
cabal-version: >=1.10 cabal-version: >=1.10
library library
exposed-modules: Configuration exposed-modules: Data.Versioned
, Data.Versioned
-- other-extensions: -- other-extensions:
build-depends: base >=4.10 build-depends: base >=4.10
, classy-prelude , classy-prelude
, dhall
, foreign-store
, generic-lens , generic-lens
, lens , lens
, mtl , mtl
@ -32,20 +29,19 @@ library
, RecordWildCards , RecordWildCards
default-language: Haskell2010 default-language: Haskell2010
test-suite spec -- test-suite spec
type: exitcode-stdio-1.0 -- type: exitcode-stdio-1.0
main-is: Spec.hs -- main-is: Spec.hs
hs-source-dirs: src -- hs-source-dirs: src
build-depends: base >=4.10 -- build-depends: base >=4.10
, classy-prelude -- , classy-prelude
, dhall -- , foreign-store
, foreign-store -- , generic-lens
, generic-lens -- , lens
, lens -- , mtl
, mtl -- , text
, text -- , transformers
, transformers -- , validity
, validity -- , genvalidity-hspec
, genvalidity-hspec -- , genvalidity-property
, genvalidity-property -- , hspec
, hspec

View File

@ -1,12 +1,6 @@
{ nixpkgs, haskellPackages }: { nixpkgs, haskellPackages }:
let let
jsaddle = nixpkgs.fetchFromGitHub {
owner = "ghcjs";
repo = "jsaddle";
rev = "34fe7d61b3f387b81aa748294ac8d993243f53b4";
sha256 = "0qdh5qdk23vcp1yp910zgw2hs4zpbx9ig25xgaax0iwj2m1ifh5x";
};
miso = nixpkgs.fetchFromGitHub { miso = nixpkgs.fetchFromGitHub {
owner = "dmjio"; owner = "dmjio";
repo = "miso"; repo = "miso";
@ -28,8 +22,6 @@ in
}; };
overrides = self: super: { overrides = self: super: {
generic-lens = nixpkgs.haskell.lib.dontCheck super.generic-lens; generic-lens = nixpkgs.haskell.lib.dontCheck super.generic-lens;
jsaddle-warp = nixpkgs.haskell.lib.dontCheck (super.callPackage (jsaddle + "/jsaddle-warp") {});
jsaddle = super.callPackage (jsaddle + "/jsaddle") {};
miso = miso-jsaddle super; miso = miso-jsaddle super;
# doctest = null; # Not compilable with ghcjs # doctest = null; # Not compilable with ghcjs
# comonad = dontCheck super.comonad; # comonad = dontCheck super.comonad;

View File

@ -23,5 +23,6 @@ executable frontend
, miso , miso
, jsaddle-warp , jsaddle-warp
, mtl , mtl
, common
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010

16
ghcjs.patch Normal file
View File

@ -0,0 +1,16 @@
diff --git a/lib/boot/shims/src/string.js b/lib/boot/shims/src/string.js
index d82f75a..f16e55a 100644
--- a/lib/boot/shims/src/string.js
+++ b/lib/boot/shims/src/string.js
@@ -780,11 +780,7 @@ function h$throwJSException(e) {
// adding the Exception dictionary
var strVal = e.toString() + '\n' + Array.prototype.join.call(e.stack, '\n');
var someE = MK_SOMEEXCEPTION(HS_JSEXCEPTION_EXCEPTION,
-#ifdef GHCJS_PROF
- MK_JSEXCEPTION(MK_JSVAL(e), h$toHsString(strVal), h$CCS_SYSTEM))
-#else
MK_JSEXCEPTION(MK_JSVAL(e), h$toHsString(strVal))
-#endif
);
return h$throw(someE, true);
}

14
jsaddle-warp-ghcjs.nix Normal file
View File

@ -0,0 +1,14 @@
{ mkDerivation, base, fetchgit, stdenv }:
mkDerivation {
pname = "jsaddle-warp";
version = "0.9.5.0";
src = fetchgit {
url = "https://github.com/ghcjs/jsaddle.git";
rev = "34fe7d61b3f387b81aa748294ac8d993243f53b4";
sha256 = "0qdh5qdk23vcp1yp910zgw2hs4zpbx9ig25xgaax0iwj2m1ifh5x";
};
postUnpack = "sourceRoot+=/jsaddle-warp; echo source root reset to $sourceRoot";
libraryHaskellDepends = [ base ];
description = "Interface for JavaScript that works with GHCJS and GHC";
license = stdenv.lib.licenses.mit;
}

View File

@ -18,12 +18,17 @@ let
(self: super: mapAttrs (name: path: self.callCabal2nix name path {}) packages) (self: super: mapAttrs (name: path: self.callCabal2nix name path {}) packages)
overrides overrides
]; ];
haskellPackages' = haskellPackages.override { overrides = overrides'; }; haskellPackages' = haskellPackages.extend overrides';
packages' = mapAttrs (name: _: haskellPackages'."${name}") packages; packages' = mapAttrs (name: _: haskellPackages'."${name}") packages;
mkShell = name: pkg: mkShell = name: pkg:
let let
n = "${name}-shell"; n = "${name}-shell";
deps = haskellPackages'.ghcWithHoogle (pkgs: pkg.buildInputs ++ pkg.propagatedBuildInputs); deps = with haskellPackages'; [
ghcid
cabal-install
hasktags
(haskellPackages'.ghcWithHoogle (pkgs: pkg.buildInputs ++ pkg.propagatedBuildInputs))
];
in in
{ {
name = "${n}"; name = "${n}";

View File

@ -2,13 +2,31 @@
let let
jsaddle = nixpkgs.fetchFromGitHub {
owner = "ghcjs";
repo = "jsaddle";
rev = "34fe7d61b3f387b81aa748294ac8d993243f53b4";
sha256 = "0qdh5qdk23vcp1yp910zgw2hs4zpbx9ig25xgaax0iwj2m1ifh5x";
};
config = { config = {
packageOverrides = pkgs: with pkgs.haskell.lib; with pkgs.lib; { packageOverrides = pkgs: with pkgs.haskell.lib; with pkgs.lib; {
haskell = pkgs.haskell // { haskell = pkgs.haskell // {
packages = pkgs.haskell.packages // { packages = pkgs.haskell.packages // {
ghcjs84 = pkgs.haskell.packages.ghcjs84.override { ghccustom = pkgs.haskell.packages.ghc843.override {
overrides = self: super: {
jsaddle-warp = dontCheck (super.callPackage (jsaddle + "/jsaddle-warp") {});
# jsaddle-warp = super.callPackage ./jsaddle-warp-ghcjs.nix {};
jsaddle = dontCheck (super.callPackage (jsaddle + "/jsaddle") {});
};
};
ghcjscustom = pkgs.haskell.packages.ghcjs84.override {
overrides = self: super: { overrides = self: super: {
doctest = null; doctest = null;
comonad = dontCheck (super.comonad);
classy-prelude = dontCheck (super.classy-prelude);
unliftio = dontCheck (super.unliftio);
semigroupoids = dontCheck (super.semigroupoids);
lens = dontCheck (super.lens);
directory-tree = dontCheck (super.directory-tree); directory-tree = dontCheck (super.directory-tree);
http-types = dontCheck (super.http-types); http-types = dontCheck (super.http-types);
tasty-quickcheck = dontCheck (super.tasty-quickcheck); tasty-quickcheck = dontCheck (super.tasty-quickcheck);
@ -19,7 +37,7 @@ let
ghcjsSrc = pkgs.fetchgit { ghcjsSrc = pkgs.fetchgit {
url = "https://github.com/ghcjs/ghcjs.git"; url = "https://github.com/ghcjs/ghcjs.git";
rev = "dc190b1bb2453cfa484124e9f335ee3cad1492f7"; rev = "dc190b1bb2453cfa484124e9f335ee3cad1492f7";
sha256 = "0dh52aj0f3700zfyrhisy44b6y9p1bsawwrmd5pllpdyw21zd9lw"; sha256 = "0dh52gj0f3700zfyrhisy44b6y9p1bsawwrmd5pllpdyw21zd9lw";
fetchSubmodules = true; fetchSubmodules = true;
}; };
}) (drv: { patches = (drv.patches or []) ++ [ ./ghcjs.patch ]; }); }) (drv: { patches = (drv.patches or []) ++ [ ./ghcjs.patch ]; });
@ -35,11 +53,20 @@ let
repo = "nixpkgs"; repo = "nixpkgs";
inherit (pinnedVersion) rev sha256; inherit (pinnedVersion) rev sha256;
}) { inherit config; }; }) { inherit config; };
ghc = import ./default.nix { nixpkgs = pinnedPkgs; haskellPackages = pinnedPkgs.haskell.packages.ghccustom; };
ghcjs = import ./default.nix { nixpkgs = pinnedPkgs; haskellPackages = pinnedPkgs.haskell.packages.ghcjscustom; };
inherit (pinnedPkgs) pkgs; inherit (pinnedPkgs) pkgs;
in in
{ {
ghc = import ./default.nix { nixpkgs = pinnedPkgs; haskellPackages = pinnedPkgs.haskell.packages.ghc843; }; inherit ghc ghcjs;
ghcjs = import ./default.nix { nixpkgs = pinnedPkgs; haskellPackages = pinnedPkgs.haskell.packages.ghcjs84; }; deps = pkgs.buildEnv {
name = "deps";
paths = [
(pkgs.haskell.packages.ghccustom.ghcWithPackages (_: ghc.backend.buildInputs ++ ghc.backend.propagatedBuildInputs))
(pkgs.haskell.packages.ghcjscustom.ghcWithPackages (_: ghcjs.frontend.buildInputs ++ ghcjs.frontend.propagatedBuildInputs))
];
buildInputs = [ ];
};
} }