parent
d792cb2a81
commit
6865af361d
5
backend/ChangeLog.md
Normal file
5
backend/ChangeLog.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Revision history for backend
|
||||||
|
|
||||||
|
## 0.1.0.0 -- YYYY-mm-dd
|
||||||
|
|
||||||
|
* First version. Released on an unsuspecting world.
|
30
backend/LICENSE
Normal file
30
backend/LICENSE
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
Copyright (c) 2018, Mats Rauhala
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following
|
||||||
|
disclaimer in the documentation and/or other materials provided
|
||||||
|
with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of Mats Rauhala nor the names of other
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2
backend/Setup.hs
Normal file
2
backend/Setup.hs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
import Distribution.Simple
|
||||||
|
main = defaultMain
|
@ -1,4 +1,7 @@
|
|||||||
name: ebook-manager
|
-- Initial backend.cabal generated by cabal init. For further
|
||||||
|
-- documentation, see http://haskell.org/cabal/users-guide/
|
||||||
|
|
||||||
|
name: backend
|
||||||
version: 0.1.0.0
|
version: 0.1.0.0
|
||||||
-- synopsis:
|
-- synopsis:
|
||||||
-- description:
|
-- description:
|
||||||
@ -12,7 +15,7 @@ build-type: Simple
|
|||||||
extra-source-files: ChangeLog.md
|
extra-source-files: ChangeLog.md
|
||||||
cabal-version: >=1.10
|
cabal-version: >=1.10
|
||||||
|
|
||||||
executable ebook-manager
|
executable backend
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
other-modules: Devel.Main
|
other-modules: Devel.Main
|
||||||
, API
|
, API
|
||||||
@ -20,8 +23,6 @@ executable ebook-manager
|
|||||||
, API.Catalogue
|
, API.Catalogue
|
||||||
, API.Channels
|
, API.Channels
|
||||||
, API.Users
|
, API.Users
|
||||||
, Configuration
|
|
||||||
, Data.Versioned
|
|
||||||
, Database
|
, Database
|
||||||
, Database.Book
|
, Database.Book
|
||||||
, Database.Channel
|
, Database.Channel
|
||||||
@ -36,6 +37,7 @@ executable ebook-manager
|
|||||||
, View
|
, View
|
||||||
-- other-extensions:
|
-- other-extensions:
|
||||||
build-depends: base >=4.10 && <4.11
|
build-depends: base >=4.10 && <4.11
|
||||||
|
, common
|
||||||
, aeson
|
, aeson
|
||||||
, asn1-data
|
, asn1-data
|
||||||
, asn1-types
|
, asn1-types
|
||||||
@ -77,8 +79,8 @@ executable ebook-manager
|
|||||||
, xml-conduit
|
, xml-conduit
|
||||||
, xml-hamlet
|
, xml-hamlet
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
|
default-language: Haskell2010
|
||||||
default-extensions: DeriveGeneric
|
default-extensions: DeriveGeneric
|
||||||
, NoImplicitPrelude
|
, NoImplicitPrelude
|
||||||
, OverloadedStrings
|
, OverloadedStrings
|
||||||
, RecordWildCards
|
, RecordWildCards
|
||||||
default-language: Haskell2010
|
|
@ -37,7 +37,7 @@ update = do
|
|||||||
|
|
||||||
develMain :: IO ()
|
develMain :: IO ()
|
||||||
develMain = do
|
develMain = do
|
||||||
conf <- input auto "./config/devel.dhall"
|
conf <- input auto "../config/devel.dhall"
|
||||||
withApp conf $ \app -> do
|
withApp conf $ \app -> do
|
||||||
void $ runReaderT (runDB migrate) app
|
void $ runReaderT (runDB migrate) app
|
||||||
defaultMain app
|
defaultMain app
|
30
common/LICENSE
Normal file
30
common/LICENSE
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
Copyright (c) 2018, Mats Rauhala
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following
|
||||||
|
disclaimer in the documentation and/or other materials provided
|
||||||
|
with the distribution.
|
||||||
|
|
||||||
|
* Neither the name of Mats Rauhala nor the names of other
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
65
common/common.cabal
Normal file
65
common/common.cabal
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
name: common
|
||||||
|
version: 0.1.0.0
|
||||||
|
-- synopsis:
|
||||||
|
-- description:
|
||||||
|
license: BSD3
|
||||||
|
license-file: LICENSE
|
||||||
|
author: Mats Rauhala
|
||||||
|
maintainer: mats.rauhala@iki.fi
|
||||||
|
-- copyright:
|
||||||
|
category: Web
|
||||||
|
build-type: Simple
|
||||||
|
extra-source-files: ChangeLog.md
|
||||||
|
cabal-version: >=1.10
|
||||||
|
|
||||||
|
library
|
||||||
|
exposed-modules: Configuration
|
||||||
|
, Data.Versioned
|
||||||
|
-- other-extensions:
|
||||||
|
build-depends: base >=4.10 && <4.11
|
||||||
|
, aeson
|
||||||
|
, asn1-data
|
||||||
|
, asn1-types
|
||||||
|
, bytestring
|
||||||
|
, classy-prelude
|
||||||
|
, cryptonite
|
||||||
|
, dhall
|
||||||
|
, directory
|
||||||
|
, foreign-store
|
||||||
|
, generic-lens
|
||||||
|
, http-api-data
|
||||||
|
, http-media
|
||||||
|
, jose
|
||||||
|
, lens
|
||||||
|
, lucid
|
||||||
|
, memory
|
||||||
|
, monad-logger
|
||||||
|
, mtl
|
||||||
|
, pandoc
|
||||||
|
, pandoc-types
|
||||||
|
, pem
|
||||||
|
, process
|
||||||
|
, resource-pool
|
||||||
|
, selda
|
||||||
|
, selda-postgresql
|
||||||
|
, servant
|
||||||
|
, servant-auth
|
||||||
|
, servant-auth-server
|
||||||
|
, servant-docs
|
||||||
|
, servant-lucid
|
||||||
|
, servant-multipart
|
||||||
|
, servant-server
|
||||||
|
, text
|
||||||
|
, transformers
|
||||||
|
, wai
|
||||||
|
, warp
|
||||||
|
, x509
|
||||||
|
, x509-store
|
||||||
|
, xml-conduit
|
||||||
|
, xml-hamlet
|
||||||
|
hs-source-dirs: src
|
||||||
|
default-extensions: DeriveGeneric
|
||||||
|
, NoImplicitPrelude
|
||||||
|
, OverloadedStrings
|
||||||
|
, RecordWildCards
|
||||||
|
default-language: Haskell2010
|
16
default.nix
16
default.nix
@ -1,10 +1,8 @@
|
|||||||
{ mkDerivation, base, stdenv }:
|
{ nixpkgs, haskellPackages }:
|
||||||
mkDerivation {
|
|
||||||
pname = "ebook-manager";
|
(import ./project.nix nixpkgs) {
|
||||||
version = "0.1.0.0";
|
packages = {
|
||||||
src = ./.;
|
common = ./common;
|
||||||
isLibrary = false;
|
backend = ./backend;
|
||||||
isExecutable = true;
|
};
|
||||||
executableHaskellDepends = [ base ];
|
|
||||||
license = stdenv.lib.licenses.bsd3;
|
|
||||||
}
|
}
|
||||||
|
37
project.nix
Normal file
37
project.nix
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
nixpkgs:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (nixpkgs.lib) mapAttrs mapAttrsToList escapeShellArg optionalString concatStringsSep concatMapStringsSep;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{ packages
|
||||||
|
, overrides ? _ : _ : {}
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
overrides' = nixpkgs.lib.foldr nixpkgs.lib.composeExtensions (_: _: {}) [
|
||||||
|
(self: super: mapAttrs (name: path: self.callCabal2nix name path {}) packages)
|
||||||
|
];
|
||||||
|
haskellPackages = nixpkgs.haskellPackages.override { overrides = overrides'; };
|
||||||
|
packages' = mapAttrs (name: _: haskellPackages."${name}") packages;
|
||||||
|
mkShell = name: pkg:
|
||||||
|
let
|
||||||
|
n = "${name}-shell";
|
||||||
|
deps = haskellPackages.ghcWithPackages (pkgs: pkg.nativeBuildInputs);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = "${n}";
|
||||||
|
value = nixpkgs.buildEnv {
|
||||||
|
name = "${n}";
|
||||||
|
paths = [];
|
||||||
|
buildInputs = [deps];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
shells = nixpkgs.lib.listToAttrs (mapAttrsToList mkShell packages');
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
packages' // shells
|
15
release.nix
Normal file
15
release.nix
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{ nixpkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
pinnedVersion = nixpkgs.lib.importJSON ./nixpkgs-version.json;
|
||||||
|
pinnedPkgs = import (nixpkgs.fetchFromGitHub {
|
||||||
|
owner = "NixOS";
|
||||||
|
repo = "nixpkgs";
|
||||||
|
inherit (pinnedVersion) rev sha256;
|
||||||
|
}) {};
|
||||||
|
inherit (pinnedPkgs) pkgs;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
import ./default.nix { nixpkgs = pinnedPkgs; haskellPackages = pinnedPkgs.haskellPackages; }
|
Loading…
Reference in New Issue
Block a user