diff options
Diffstat (limited to 'overlays')
| -rw-r--r-- | overlays/spm/default.nix | 3 | ||||
| -rw-r--r-- | overlays/spm/lib/Spm/Api.hs | 19 | ||||
| -rw-r--r-- | overlays/spm/server/Spm/Server.hs | 7 | ||||
| -rw-r--r-- | overlays/spm/server/Spm/Server/Ctx.hs | 3 | ||||
| -rw-r--r-- | overlays/spm/server/Spm/Server/Database.hs | 9 |
5 files changed, 20 insertions, 21 deletions
diff --git a/overlays/spm/default.nix b/overlays/spm/default.nix index ff135279..bd81ef82 100644 --- a/overlays/spm/default.nix +++ b/overlays/spm/default.nix | |||
| @@ -4,10 +4,11 @@ let | |||
| 4 | # defaultPackages = (import ./stackage.nix {}); | 4 | # defaultPackages = (import ./stackage.nix {}); |
| 5 | # haskellPackages = defaultPackages // argumentPackages; | 5 | # haskellPackages = defaultPackages // argumentPackages; |
| 6 | # haskellPackages = argumentPackages; | 6 | # haskellPackages = argumentPackages; |
| 7 | haskellPackages = final.haskell.packages.ghc96.override { | 7 | haskellPackages = final.haskell.packages.ghc912.override { |
| 8 | overrides = self: super: { | 8 | overrides = self: super: { |
| 9 | warp-systemd = final.haskell.lib.doJailbreak (super.warp-systemd.overrideAttrs (oldAttrs: { meta = oldAttrs.meta // { broken = false; }; })); | 9 | warp-systemd = final.haskell.lib.doJailbreak (super.warp-systemd.overrideAttrs (oldAttrs: { meta = oldAttrs.meta // { broken = false; }; })); |
| 10 | unliftio-pool = final.haskell.lib.doJailbreak super.unliftio-pool; | 10 | unliftio-pool = final.haskell.lib.doJailbreak super.unliftio-pool; |
| 11 | cryptonite = super.cryptonite.overrideAttrs (oldAttrs: { doCheck = false; }); | ||
| 11 | # servant-server = super.servant-server.overrideAttrs (oldAttrs: { | 12 | # servant-server = super.servant-server.overrideAttrs (oldAttrs: { |
| 12 | # patches = []; | 13 | # patches = []; |
| 13 | # }); | 14 | # }); |
diff --git a/overlays/spm/lib/Spm/Api.hs b/overlays/spm/lib/Spm/Api.hs index 8285cc55..3c22bfb6 100644 --- a/overlays/spm/lib/Spm/Api.hs +++ b/overlays/spm/lib/Spm/Api.hs | |||
| @@ -21,7 +21,6 @@ import Data.Text (Text) | |||
| 21 | import qualified Data.Text as Text | 21 | import qualified Data.Text as Text |
| 22 | 22 | ||
| 23 | import GHC.Generics (Generic) | 23 | import GHC.Generics (Generic) |
| 24 | import Type.Reflection (Typeable) | ||
| 25 | 24 | ||
| 26 | import Control.Lens | 25 | import Control.Lens |
| 27 | 26 | ||
| @@ -62,7 +61,7 @@ instance FromHttpApiData SpmStyle where | |||
| 62 | 61 | ||
| 63 | 62 | ||
| 64 | newtype SpmMailbox = SpmMailbox { unSpmMailbox :: CI Text } | 63 | newtype SpmMailbox = SpmMailbox { unSpmMailbox :: CI Text } |
| 65 | deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 64 | deriving stock (Eq, Ord, Read, Show, Generic) |
| 66 | deriving newtype (MimeRender PlainText) | 65 | deriving newtype (MimeRender PlainText) |
| 67 | makeWrapped ''SpmMailbox | 66 | makeWrapped ''SpmMailbox |
| 68 | 67 | ||
| @@ -70,7 +69,7 @@ instance MimeRender JSON SpmMailbox where | |||
| 70 | mimeRender p mbox = mimeRender p $ JSON.object [ "mailbox" JSON..= unSpmMailbox mbox ] | 69 | mimeRender p mbox = mimeRender p $ JSON.object [ "mailbox" JSON..= unSpmMailbox mbox ] |
| 71 | 70 | ||
| 72 | newtype SpmDomain = SpmDomain { unSpmDomain :: CI Text } | 71 | newtype SpmDomain = SpmDomain { unSpmDomain :: CI Text } |
| 73 | deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 72 | deriving stock (Eq, Ord, Read, Show, Generic) |
| 74 | deriving newtype (MimeRender PlainText) | 73 | deriving newtype (MimeRender PlainText) |
| 75 | makeWrapped ''SpmDomain | 74 | makeWrapped ''SpmDomain |
| 76 | 75 | ||
| @@ -79,17 +78,17 @@ instance MimeRender JSON SpmDomain where | |||
| 79 | 78 | ||
| 80 | newtype SpmLocal = SpmLocal | 79 | newtype SpmLocal = SpmLocal |
| 81 | { unSpmLocal :: CI Text | 80 | { unSpmLocal :: CI Text |
| 82 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 81 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 83 | deriving newtype (ToJSON, FromJSON) | 82 | deriving newtype (ToJSON, FromJSON) |
| 84 | makeWrapped ''SpmLocal | 83 | makeWrapped ''SpmLocal |
| 85 | newtype SpmExtension = SpmExtension | 84 | newtype SpmExtension = SpmExtension |
| 86 | { unSpmExtension :: CI Text | 85 | { unSpmExtension :: CI Text |
| 87 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 86 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 88 | deriving newtype (ToJSON, FromJSON) | 87 | deriving newtype (ToJSON, FromJSON) |
| 89 | makeWrapped ''SpmExtension | 88 | makeWrapped ''SpmExtension |
| 90 | 89 | ||
| 91 | data SpmMappingState = Valid | Reject | 90 | data SpmMappingState = Valid | Reject |
| 92 | deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Typeable) | 91 | deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic) |
| 93 | instance MimeRender PlainText SpmMappingState where | 92 | instance MimeRender PlainText SpmMappingState where |
| 94 | mimeRender p = mimeRender @_ @Text p . \case | 93 | mimeRender p = mimeRender @_ @Text p . \case |
| 95 | Valid -> "valid" | 94 | Valid -> "valid" |
| @@ -109,15 +108,15 @@ _SpmMappingStateReject = iso toReject fromReject | |||
| 109 | data SpmMappingListingItem = SpmMappingListingItem | 108 | data SpmMappingListingItem = SpmMappingListingItem |
| 110 | { smlMapping :: SpmMapping | 109 | { smlMapping :: SpmMapping |
| 111 | , smlState :: SpmMappingState | 110 | , smlState :: SpmMappingState |
| 112 | } deriving (Eq, Ord, Read, Show, Generic, Typeable) | 111 | } deriving (Eq, Ord, Read, Show, Generic) |
| 113 | 112 | ||
| 114 | newtype SpmMappingListing = SpmMappingListing { unSpmMappingListing :: [SpmMappingListingItem] } | 113 | newtype SpmMappingListing = SpmMappingListing { unSpmMappingListing :: [SpmMappingListingItem] } |
| 115 | deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 114 | deriving stock (Eq, Ord, Read, Show, Generic) |
| 116 | 115 | ||
| 117 | data SpmMapping = SpmMapping | 116 | data SpmMapping = SpmMapping |
| 118 | { spmMappingLocal :: Maybe SpmLocal | 117 | { spmMappingLocal :: Maybe SpmLocal |
| 119 | , spmMappingExtension :: Maybe SpmExtension | 118 | , spmMappingExtension :: Maybe SpmExtension |
| 120 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 119 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 121 | 120 | ||
| 122 | _SpmMappingText :: Iso' SpmMapping Text | 121 | _SpmMappingText :: Iso' SpmMapping Text |
| 123 | _SpmMappingText = iso toText fromText | 122 | _SpmMappingText = iso toText fromText |
| @@ -170,7 +169,7 @@ instance ToJSON SpmMappingListing where | |||
| 170 | data SpmJWTClaims = SpmJWTClaims | 169 | data SpmJWTClaims = SpmJWTClaims |
| 171 | { spmjwtStdClaims :: ClaimsSet | 170 | { spmjwtStdClaims :: ClaimsSet |
| 172 | , spmjwtLocal :: SpmLocal | 171 | , spmjwtLocal :: SpmLocal |
| 173 | } deriving stock (Eq, Show, Generic, Typeable) | 172 | } deriving stock (Eq, Show, Generic) |
| 174 | 173 | ||
| 175 | makeLensesFor [("spmjwtStdClaims", "_stdClaims"), ("spmjwtLocal", "_spmjwtLocal")] ''SpmJWTClaims | 174 | makeLensesFor [("spmjwtStdClaims", "_stdClaims"), ("spmjwtLocal", "_spmjwtLocal")] ''SpmJWTClaims |
| 176 | 175 | ||
diff --git a/overlays/spm/server/Spm/Server.hs b/overlays/spm/server/Spm/Server.hs index 8e7f8786..dc334729 100644 --- a/overlays/spm/server/Spm/Server.hs +++ b/overlays/spm/server/Spm/Server.hs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | {-# OPTIONS_GHC -Wno-orphans #-} | ||
| 2 | |||
| 1 | {-# LANGUAGE OverloadedStrings #-} | 3 | {-# LANGUAGE OverloadedStrings #-} |
| 2 | 4 | ||
| 3 | module Spm.Server | 5 | module Spm.Server |
| @@ -24,7 +26,6 @@ import Data.Attoparsec.Text | |||
| 24 | import qualified Data.ByteString.Lazy as LBS | 26 | import qualified Data.ByteString.Lazy as LBS |
| 25 | 27 | ||
| 26 | import GHC.Generics (Generic) | 28 | import GHC.Generics (Generic) |
| 27 | import Type.Reflection (Typeable) | ||
| 28 | 29 | ||
| 29 | import Control.Applicative | 30 | import Control.Applicative |
| 30 | import Control.Monad | 31 | import Control.Monad |
| @@ -101,7 +102,7 @@ hSslClientSDn = "SSL-Client-S-DN" | |||
| 101 | data SSLClientVerify | 102 | data SSLClientVerify |
| 102 | = SSLClientVerifySuccess | 103 | = SSLClientVerifySuccess |
| 103 | | SSLClientVerifyOther Text | 104 | | SSLClientVerifyOther Text |
| 104 | deriving (Eq, Ord, Read, Show, Generic, Typeable) | 105 | deriving (Eq, Ord, Read, Show, Generic) |
| 105 | instance FromHttpApiData SSLClientVerify where | 106 | instance FromHttpApiData SSLClientVerify where |
| 106 | parseUrlPiece = (left Text.pack .) . parseOnly $ p <* endOfInput | 107 | parseUrlPiece = (left Text.pack .) . parseOnly $ p <* endOfInput |
| 107 | where | 108 | where |
| @@ -163,7 +164,7 @@ data ServerCtxError | |||
| 163 | | ServerCtxNoCredentialsDirectory | 164 | | ServerCtxNoCredentialsDirectory |
| 164 | | ServerCtxJwkSetDecodeError String | 165 | | ServerCtxJwkSetDecodeError String |
| 165 | | ServerCtxJwkSetEmpty | 166 | | ServerCtxJwkSetEmpty |
| 166 | deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 167 | deriving stock (Eq, Ord, Read, Show, Generic) |
| 167 | deriving anyclass (Exception) | 168 | deriving anyclass (Exception) |
| 168 | 169 | ||
| 169 | mkSpmApp :: (MonadUnliftIO m, MonadThrow m) => m Application | 170 | mkSpmApp :: (MonadUnliftIO m, MonadThrow m) => m Application |
diff --git a/overlays/spm/server/Spm/Server/Ctx.hs b/overlays/spm/server/Spm/Server/Ctx.hs index 18452a0a..1d228043 100644 --- a/overlays/spm/server/Spm/Server/Ctx.hs +++ b/overlays/spm/server/Spm/Server/Ctx.hs | |||
| @@ -11,7 +11,6 @@ import Database.Persist.Postgresql | |||
| 11 | import UnliftIO.Pool | 11 | import UnliftIO.Pool |
| 12 | import Control.Lens.TH | 12 | import Control.Lens.TH |
| 13 | 13 | ||
| 14 | import Type.Reflection (Typeable) | ||
| 15 | import GHC.Generics (Generic) | 14 | import GHC.Generics (Generic) |
| 16 | 15 | ||
| 17 | 16 | ||
| @@ -19,6 +18,6 @@ data ServerCtx = ServerCtx | |||
| 19 | { _sctxSqlPool :: Pool SqlBackend | 18 | { _sctxSqlPool :: Pool SqlBackend |
| 20 | , _sctxInstanceId :: UUID | 19 | , _sctxInstanceId :: UUID |
| 21 | , _sctxJwkSet :: JWKSet | 20 | , _sctxJwkSet :: JWKSet |
| 22 | } deriving (Generic, Typeable) | 21 | } deriving (Generic) |
| 23 | makeLenses ''ServerCtx | 22 | makeLenses ''ServerCtx |
| 24 | 23 | ||
diff --git a/overlays/spm/server/Spm/Server/Database.hs b/overlays/spm/server/Spm/Server/Database.hs index 3156e920..4405452f 100644 --- a/overlays/spm/server/Spm/Server/Database.hs +++ b/overlays/spm/server/Spm/Server/Database.hs | |||
| @@ -13,7 +13,6 @@ import Database.Persist.Sql | |||
| 13 | import Database.Persist.TH | 13 | import Database.Persist.TH |
| 14 | 14 | ||
| 15 | import GHC.Generics (Generic) | 15 | import GHC.Generics (Generic) |
| 16 | import Type.Reflection (Typeable) | ||
| 17 | 16 | ||
| 18 | import Data.Text (Text) | 17 | import Data.Text (Text) |
| 19 | 18 | ||
| @@ -33,22 +32,22 @@ import Web.HttpApiData | |||
| 33 | 32 | ||
| 34 | newtype MailMailbox = MailMailbox | 33 | newtype MailMailbox = MailMailbox |
| 35 | { unMailMailbox :: CI Text | 34 | { unMailMailbox :: CI Text |
| 36 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 35 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 37 | deriving newtype (PersistField, PersistFieldSql) | 36 | deriving newtype (PersistField, PersistFieldSql) |
| 38 | makeWrapped ''MailMailbox | 37 | makeWrapped ''MailMailbox |
| 39 | newtype MailLocal = MailLocal | 38 | newtype MailLocal = MailLocal |
| 40 | { unMailLocal :: CI Text | 39 | { unMailLocal :: CI Text |
| 41 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 40 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 42 | deriving newtype (PersistField, PersistFieldSql) | 41 | deriving newtype (PersistField, PersistFieldSql) |
| 43 | makeWrapped ''MailLocal | 42 | makeWrapped ''MailLocal |
| 44 | newtype MailExtension = MailExtension | 43 | newtype MailExtension = MailExtension |
| 45 | { unMailExtension :: CI Text | 44 | { unMailExtension :: CI Text |
| 46 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 45 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 47 | deriving newtype (PersistField, PersistFieldSql) | 46 | deriving newtype (PersistField, PersistFieldSql) |
| 48 | makeWrapped ''MailExtension | 47 | makeWrapped ''MailExtension |
| 49 | newtype MailDomain = MailDomain | 48 | newtype MailDomain = MailDomain |
| 50 | { unMailDomain :: CI Text | 49 | { unMailDomain :: CI Text |
| 51 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 50 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 52 | deriving newtype (PersistField, PersistFieldSql) | 51 | deriving newtype (PersistField, PersistFieldSql) |
| 53 | makeWrapped ''MailDomain | 52 | makeWrapped ''MailDomain |
| 54 | 53 | ||
