Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9d76def10 | ||
|
|
fda3a000f9 | ||
|
|
1c95b01004 |
44
flake.lock
Normal file
44
flake.lock
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1619345332,
|
||||||
|
"narHash": "sha256-qHnQkEp1uklKTpx3MvKtY6xzgcqXDsz5nLilbbuL+3A=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "2ebf2558e5bf978c7fb8ea927dfaed8fefab2e28",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1620323686,
|
||||||
|
"narHash": "sha256-+gfcE3YTGl+Osc8HzOUXSFO8/0PAK4J8ZxCXZ4hjXHI=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "dfacb8329b2236688b9a1e705116203a213b283a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "master",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
30
flake.nix
Normal file
30
flake.nix
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs = {
|
||||||
|
type = "github";
|
||||||
|
owner = "NixOS";
|
||||||
|
repo = "nixpkgs";
|
||||||
|
ref = "master";
|
||||||
|
};
|
||||||
|
flake-utils = {
|
||||||
|
type = "github";
|
||||||
|
owner = "numtide";
|
||||||
|
repo = "flake-utils";
|
||||||
|
ref = "master";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem
|
||||||
|
(system:
|
||||||
|
let pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
devShell = pkgs.mkShell {
|
||||||
|
name = "uni2work-serversession";
|
||||||
|
nativeBuildInputs = with pkgs.haskellPackages; [ stack ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
8
nixpkgs.nix
Normal file
8
nixpkgs.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import (
|
||||||
|
let
|
||||||
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||||
|
in fetchTarball {
|
||||||
|
url = "https://api.github.com/repos/NixOS/nixpkgs/tarball/${lock.nodes.nixpkgs.locked.rev}";
|
||||||
|
sha256 = lock.nodes.nixpkgs.locked.narHash;
|
||||||
|
}
|
||||||
|
)
|
||||||
@ -26,7 +26,7 @@ library
|
|||||||
, acid-state >= 0.16
|
, acid-state >= 0.16
|
||||||
, containers
|
, containers
|
||||||
, mtl
|
, mtl
|
||||||
, safecopy >= 0.8
|
, safecopy >= 0.8 && <0.11
|
||||||
, unordered-containers
|
, unordered-containers
|
||||||
|
|
||||||
, serversession == 1.0.*
|
, serversession == 1.0.*
|
||||||
|
|||||||
@ -113,6 +113,8 @@ instance Typeable sess => SafeCopy (SS.SessionId sess) where
|
|||||||
putCopy = contain . safePut . SSI.unS
|
putCopy = contain . safePut . SSI.unS
|
||||||
getCopy = contain $ SSI.S <$> safeGet
|
getCopy = contain $ SSI.S <$> safeGet
|
||||||
|
|
||||||
|
errorTypeName _ = "SessionId"
|
||||||
|
|
||||||
|
|
||||||
-- | We can't @deriveSafeCopy 0 'base ''SS.Session@ due to the
|
-- | We can't @deriveSafeCopy 0 'base ''SS.Session@ due to the
|
||||||
-- required context.
|
-- required context.
|
||||||
@ -133,6 +135,8 @@ instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (SS.Session
|
|||||||
<*> get_t
|
<*> get_t
|
||||||
<*> get_t
|
<*> get_t
|
||||||
|
|
||||||
|
errorTypeName _ = "Session"
|
||||||
|
|
||||||
|
|
||||||
-- | We can't @deriveSafeCopy 0 'base ''ServerSessionAcidState@ due
|
-- | We can't @deriveSafeCopy 0 'base ''ServerSessionAcidState@ due
|
||||||
-- to the required context.
|
-- to the required context.
|
||||||
@ -145,6 +149,8 @@ instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (ServerSessi
|
|||||||
<$> (HM.fromList <$> safeGet)
|
<$> (HM.fromList <$> safeGet)
|
||||||
<*> (HM.fromList <$> safeGet)
|
<*> (HM.fromList <$> safeGet)
|
||||||
|
|
||||||
|
errorTypeName _ = "ServerSessionAcidState"
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
@ -281,10 +287,14 @@ instance Typeable sess => SafeCopy (DeleteSession sess) where
|
|||||||
putCopy (DeleteSession v) = contain $ safePut v
|
putCopy (DeleteSession v) = contain $ safePut v
|
||||||
getCopy = contain $ DeleteSession <$> safeGet
|
getCopy = contain $ DeleteSession <$> safeGet
|
||||||
|
|
||||||
|
errorTypeName _ = "DeleteSession"
|
||||||
|
|
||||||
instance Typeable sess => SafeCopy (DeleteAllSessionsOfAuthId sess) where
|
instance Typeable sess => SafeCopy (DeleteAllSessionsOfAuthId sess) where
|
||||||
putCopy (DeleteAllSessionsOfAuthId v) = contain $ safePut v
|
putCopy (DeleteAllSessionsOfAuthId v) = contain $ safePut v
|
||||||
getCopy = contain $ DeleteAllSessionsOfAuthId <$> safeGet
|
getCopy = contain $ DeleteAllSessionsOfAuthId <$> safeGet
|
||||||
|
|
||||||
|
errorTypeName _ = "DeleteAllSessionsOfAuthId"
|
||||||
|
|
||||||
instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (InsertSession sess) where
|
instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (InsertSession sess) where
|
||||||
putCopy (InsertSession v) = contain $ safePut v
|
putCopy (InsertSession v) = contain $ safePut v
|
||||||
getCopy = contain $ InsertSession <$> safeGet
|
getCopy = contain $ InsertSession <$> safeGet
|
||||||
@ -293,6 +303,8 @@ instance (Typeable sess, SafeCopy (SS.Decomposed sess)) => SafeCopy (ReplaceSess
|
|||||||
putCopy (ReplaceSession v) = contain $ safePut v
|
putCopy (ReplaceSession v) = contain $ safePut v
|
||||||
getCopy = contain $ ReplaceSession <$> safeGet
|
getCopy = contain $ ReplaceSession <$> safeGet
|
||||||
|
|
||||||
|
errorTypeName _ = "ReplaceSession"
|
||||||
|
|
||||||
type AcidContext sess =
|
type AcidContext sess =
|
||||||
( SS.IsSessionData sess
|
( SS.IsSessionData sess
|
||||||
, SafeCopy sess
|
, SafeCopy sess
|
||||||
@ -322,8 +334,9 @@ instance AcidContext sess => Method (ReplaceSession sess) where
|
|||||||
|
|
||||||
instance AcidContext sess => IsAcidic (ServerSessionAcidState sess) where
|
instance AcidContext sess => IsAcidic (ServerSessionAcidState sess) where
|
||||||
acidEvents =
|
acidEvents =
|
||||||
[ QueryEvent (\(GetSession sid) -> getSession sid) safeCopyMethodSerialiser
|
[ flip QueryEvent safeCopyMethodSerialiser $ \(GetSession sid) -> getSession sid
|
||||||
, UpdateEvent (\(DeleteSession sid) -> deleteSession sid) safeCopyMethodSerialiser
|
, flip UpdateEvent safeCopyMethodSerialiser $ \(DeleteSession sid) -> deleteSession sid
|
||||||
, UpdateEvent (\(DeleteAllSessionsOfAuthId authId) -> deleteAllSessionsOfAuthId authId) safeCopyMethodSerialiser
|
, flip UpdateEvent safeCopyMethodSerialiser $ \(DeleteAllSessionsOfAuthId authId) -> deleteAllSessionsOfAuthId authId
|
||||||
, UpdateEvent (\(InsertSession session) -> insertSession session) safeCopyMethodSerialiser
|
, flip UpdateEvent safeCopyMethodSerialiser $ \(InsertSession session) -> insertSession session
|
||||||
, UpdateEvent (\(ReplaceSession session) -> replaceSession session) safeCopyMethodSerialiser ]
|
, flip UpdateEvent safeCopyMethodSerialiser $ \(ReplaceSession session) -> replaceSession session
|
||||||
|
]
|
||||||
|
|||||||
16
stack.nix
Normal file
16
stack.nix
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ ghc, nixpkgs ? import ./nixpkgs.nix }:
|
||||||
|
|
||||||
|
let
|
||||||
|
# haskellPackages = import ./stackage.nix { inherit nixpkgs; };
|
||||||
|
haskellPackages = pkgs.haskellPackages;
|
||||||
|
inherit (nixpkgs {}) pkgs;
|
||||||
|
in pkgs.haskell.lib.buildStackProject {
|
||||||
|
inherit ghc;
|
||||||
|
inherit (haskellPackages) stack;
|
||||||
|
name = "stackenv";
|
||||||
|
buildInputs = (with pkgs;
|
||||||
|
[ # postgresql zlib libsodium gmp llvm_9
|
||||||
|
]) ++ (with haskellPackages;
|
||||||
|
[ # yesod-bin happy alex
|
||||||
|
]);
|
||||||
|
}
|
||||||
@ -29,4 +29,9 @@ extra-deps:
|
|||||||
- map-syntax-0.3@sha256:ca8b449615fa57419c16a5e98844624a6ac758692b87b3cfae8c74c87c56f1b2,2420
|
- map-syntax-0.3@sha256:ca8b449615fa57419c16a5e98844624a6ac758692b87b3cfae8c74c87c56f1b2,2420
|
||||||
- pwstore-fast-2.4.4@sha256:9b6a37510d8b9f37f409a8ab3babac9181afcaaa3fce8ba1c131a7ed3de30698,1351
|
- pwstore-fast-2.4.4@sha256:9b6a37510d8b9f37f409a8ab3babac9181afcaaa3fce8ba1c131a7ed3de30698,1351
|
||||||
- xmlhtml-0.2.5.2@sha256:3f0990f725551985d777e8edb5563fe99aee998f1fde6a7633f720f76df54701,46997
|
- xmlhtml-0.2.5.2@sha256:3f0990f725551985d777e8edb5563fe99aee998f1fde6a7633f720f76df54701,46997
|
||||||
resolver: lts-15.8
|
resolver: lts-16.31
|
||||||
|
nix:
|
||||||
|
packages: []
|
||||||
|
pure: false
|
||||||
|
shell-file: ./stack.nix
|
||||||
|
add-gc-roots: true
|
||||||
|
|||||||
@ -48,7 +48,7 @@ packages:
|
|||||||
hackage: xmlhtml-0.2.5.2@sha256:3f0990f725551985d777e8edb5563fe99aee998f1fde6a7633f720f76df54701,46997
|
hackage: xmlhtml-0.2.5.2@sha256:3f0990f725551985d777e8edb5563fe99aee998f1fde6a7633f720f76df54701,46997
|
||||||
snapshots:
|
snapshots:
|
||||||
- completed:
|
- completed:
|
||||||
size: 492015
|
size: 534126
|
||||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/8.yaml
|
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/31.yaml
|
||||||
sha256: 926bc3d70249dd0ba05277ff00943c0addb35b627cb641752669e7cf771310d0
|
sha256: 637fb77049b25560622a224845b7acfe81a09fdb6a96a3c75997a10b651667f6
|
||||||
original: lts-15.8
|
original: lts-16.31
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user