Merge branch 'sandbox/MasseR/28-separate-lib' of MasseR/ebook-manager into master
This commit is contained in:
commit
eb770b91af
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
|
||||
-- synopsis:
|
||||
-- description:
|
||||
@ -12,7 +15,7 @@ build-type: Simple
|
||||
extra-source-files: ChangeLog.md
|
||||
cabal-version: >=1.10
|
||||
|
||||
executable ebook-manager
|
||||
executable backend
|
||||
main-is: Main.hs
|
||||
other-modules: Devel.Main
|
||||
, API
|
||||
@ -20,8 +23,6 @@ executable ebook-manager
|
||||
, API.Catalogue
|
||||
, API.Channels
|
||||
, API.Users
|
||||
, Configuration
|
||||
, Data.Versioned
|
||||
, Database
|
||||
, Database.Book
|
||||
, Database.Channel
|
||||
@ -36,6 +37,7 @@ executable ebook-manager
|
||||
, View
|
||||
-- other-extensions:
|
||||
build-depends: base >=4.10 && <4.11
|
||||
, common
|
||||
, aeson
|
||||
, asn1-data
|
||||
, asn1-types
|
||||
@ -77,8 +79,8 @@ executable ebook-manager
|
||||
, xml-conduit
|
||||
, xml-hamlet
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
default-extensions: DeriveGeneric
|
||||
, NoImplicitPrelude
|
||||
, OverloadedStrings
|
||||
, RecordWildCards
|
||||
default-language: Haskell2010
|
@ -37,7 +37,7 @@ update = do
|
||||
|
||||
develMain :: IO ()
|
||||
develMain = do
|
||||
conf <- input auto "./config/devel.dhall"
|
||||
conf <- input auto "../config/devel.dhall"
|
||||
withApp conf $ \app -> do
|
||||
void $ runReaderT (runDB migrate) 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.
|
33
common/common.cabal
Normal file
33
common/common.cabal
Normal file
@ -0,0 +1,33 @@
|
||||
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
|
||||
, classy-prelude
|
||||
, dhall
|
||||
, foreign-store
|
||||
, generic-lens
|
||||
, lens
|
||||
, mtl
|
||||
, text
|
||||
, transformers
|
||||
hs-source-dirs: src
|
||||
default-extensions: DeriveGeneric
|
||||
, NoImplicitPrelude
|
||||
, OverloadedStrings
|
||||
, RecordWildCards
|
||||
default-language: Haskell2010
|
20
default.nix
20
default.nix
@ -1,10 +1,12 @@
|
||||
{ mkDerivation, base, stdenv }:
|
||||
mkDerivation {
|
||||
pname = "ebook-manager";
|
||||
version = "0.1.0.0";
|
||||
src = ./.;
|
||||
isLibrary = false;
|
||||
isExecutable = true;
|
||||
executableHaskellDepends = [ base ];
|
||||
license = stdenv.lib.licenses.bsd3;
|
||||
{ nixpkgs, haskellPackages }:
|
||||
|
||||
(import ./project.nix nixpkgs) {
|
||||
packages = {
|
||||
common = ./common;
|
||||
backend = ./backend;
|
||||
};
|
||||
tools = with haskellPackages; [
|
||||
ghcid
|
||||
hasktags
|
||||
];
|
||||
}
|
||||
|
38
project.nix
Normal file
38
project.nix
Normal file
@ -0,0 +1,38 @@
|
||||
nixpkgs:
|
||||
|
||||
let
|
||||
|
||||
inherit (nixpkgs.lib) mapAttrs mapAttrsToList escapeShellArg optionalString concatStringsSep concatMapStringsSep;
|
||||
|
||||
in
|
||||
|
||||
{ packages
|
||||
, overrides ? _ : _ : {}
|
||||
, tools ? []
|
||||
}:
|
||||
|
||||
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 = tools;
|
||||
buildInputs = tools ++ [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