Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions infra/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
with { pkgs = import ./nix {}; };
let
pkgs = import ./nix {};
napalm = import pkgs.sources.napalm { inherit pkgs;} ;
in

rec
{ function = # TODO: rename to handler
{
function = # TODO: rename to handler
pkgs.runCommand "build-lambda" {}
''
cp ${./main.js} main.js
Expand Down Expand Up @@ -59,9 +63,10 @@ rec
${pkgs.zip}/bin/zip -r $out/function.zip main.js main_hs
'';


deckdeckgo-starter-dist-foo = napalm.buildPackage pkgs.sources.deckdeckgo-starter {};

deckdeckgo-starter-dist =
with
{ napalm = import pkgs.sources.napalm { inherit pkgs;} ; };
pkgs.runCommand "deckdeckgo-starter" { buildInputs = [ pkgs.nodejs pkgs.zip ]; }
''
cp -r ${napalm.buildPackage pkgs.sources.deckdeckgo-starter {}}/* .
Expand All @@ -75,9 +80,9 @@ rec
popd
'';

devshell = if ! pkgs.lib.inNixShell then null else
with
{ pkg = pkgs.haskellPackages.developPackage { root = ./handler; } ; };

devshell =
let pkg = handler.env; in
pkg.overrideAttrs(attr: {
buildInputs = with pkgs;
[ terraform awscli postgresql moreutils minio ];
Expand Down Expand Up @@ -166,11 +171,12 @@ rec
'';
});

handler = pkgs.haskellPackages.deckdeckgo-handler;
handler = pkgs.staticHaskellPackages.deckdeckgo-handler;
firebase-login = pkgs.staticHaskellPackages.firebase-login;

unsplashProxy = pkgs.haskellPackages.unsplash-proxy;
unsplashProxy = pkgs.staticHaskellPackages.unsplash-proxy;

googleKeyUpdater = pkgs.haskellPackages.google-key-updater;
googleKeyUpdater = pkgs.staticHaskellPackages.google-key-updater;

publicKey = builtins.readFile ./public.cer;

Expand Down
23 changes: 18 additions & 5 deletions infra/firebase-login/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# TODO: port tests
# TODO: fix sources
# TODO: drop nix/packages
with { pkgs = import ./nix {}; };
pkgs.callPackage ./nix/packages.nix {}
{ mkDerivation, aeson, base, bytestring, hpack, http-client
, http-client-tls, http-conduit, jose, lens, mtl, network-uri, pem
, servant, servant-client-core, servant-server, servant-swagger
, stdenv, text, unordered-containers, wai, word8, x509
}:
mkDerivation {
pname = "firebase-login";
version = "0.0.0";
src = ./.;
libraryHaskellDepends = [
aeson base bytestring http-client http-client-tls http-conduit jose
lens mtl network-uri pem servant servant-client-core servant-server
servant-swagger text unordered-containers wai word8 x509
];
libraryToolDepends = [ hpack ];
prePatch = "hpack";
license = stdenv.lib.licenses.mit;
}
4 changes: 0 additions & 4 deletions infra/firebase-login/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
with
{ overlay = _: pkgs: rec
{ inherit (import sources.niv {}) niv;
haskellPackages = pkgs.haskellPackages.override
{ overrides = _: super:
{ jose = super.callCabal2nix "jose" sources.hs-jose {}; };
};

packages = import ./packages.nix
{ inherit (pkgs) haskell lib ;
Expand Down
2 changes: 1 addition & 1 deletion infra/firebase-login/nix/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}:
rec
{ firebase-login-sdist = haskell.lib.sdistTarball firebase-login;
firebase-login = haskellPackages.callCabal2nix "firebase-login" firebase-login-source {};
firebase-login = haskellPackages.callPackage ../../firebase-login {};
firebase-login-source = lib.sourceByRegex ../.
[ "^package.yaml$"
"^src.*"
Expand Down
10 changes: 5 additions & 5 deletions infra/firebase-login/shell.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
with { pkgs = import ./nix {}; };
pkgs.haskellPackages.developPackage
{ root = ./.;
modifier = drv: drv // { buildInputs = drv.buildInputs ++ [ pkgs.cabal-install ]; } ;
}
with { pkgs = import ../nix {}; };

pkgs.haskellPackages.firebase-login.env.overrideAttrs(oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs or [] ++ [ pkgs.cabal-install ];
})
2 changes: 1 addition & 1 deletion infra/firebase-login/src/Servant/Auth/Firebase.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import qualified Network.Wai as Wai
import qualified Servant as Servant
import qualified Servant.Client.Core as Servant
import qualified Servant.Client.Core as Servant.Client
import qualified Servant.Server.Internal.RoutingApplication as Servant
import qualified Servant.Server.Internal as Servant

data Protected

Expand Down
27 changes: 27 additions & 0 deletions infra/google-key-updater/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ mkDerivation, aeson, amazonka, amazonka-core, amazonka-s3, base
, bytestring, hpack, http-client, http-client-tls, http-conduit
, http-types, servant, servant-client, servant-server, stdenv, text
, unliftio, wai, wai-cors, wai-lambda, warp, pkgsMusl
}:
mkDerivation {
pname = "google-key-updater";
version = "0.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
libraryToolDepends = [ hpack ];
executableHaskellDepends = [
aeson amazonka amazonka-core amazonka-s3 base bytestring
http-client http-client-tls http-conduit http-types servant
servant-client servant-server text unliftio wai wai-cors wai-lambda
warp
];
prePatch = "hpack";
license = stdenv.lib.licenses.agpl3;
configureFlags = [
"--ghc-option=-optl=-static"
"--extra-lib-dirs=${pkgsMusl.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${pkgsMusl.zlib.static}/lib"
"--extra-lib-dirs=${pkgsMusl.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
];
}
2 changes: 1 addition & 1 deletion infra/handler/app/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ testServer = withServer $ \port -> do

runClientM (usersPost' b someUserInfo) clientEnv >>= \case
-- TODO: test that user is returned here, even on 409
Left (FailureResponse resp) ->
Left (FailureResponse _ resp) ->
if HTTP.statusCode (responseStatusCode resp) == 409 then pure () else
error $ "Got unexpected response: " <> show resp
Left e -> error $ "Expected 409, got error: " <> show e
Expand Down
50 changes: 50 additions & 0 deletions infra/handler/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ mkDerivation, aeson, amazonka, amazonka-cloudfront, amazonka-core
, amazonka-s3, amazonka-sqs, base, bytestring, cases, conduit
, conduit-extra, contravariant, cryptonite, directory, filepath
, firebase-login, hasql, hpack, http-client, http-client-tls
, http-types, lens, memory, mime-types, mtl, port-utils, pureMD5
, random, resourcet, servant, servant-client, servant-server
, servant-swagger, servant-swagger-ui, stdenv, swagger2, tagsoup
, tasty, tasty-hunit, temporary, text, time, unliftio
, unordered-containers, wai, wai-cors, wai-lambda, warp
, zip-archive, pkgsMusl
}:
mkDerivation {
pname = "deckdeckgo-handler";
version = "0.0.0";
src = ./.;
isLibrary = true;
isExecutable = true;
enableLibraryProfiling = false;
enableExecutableProfiling = false;
enableSharedExecutables = false;
enableSharedLibraries = false;
libraryHaskellDepends = [
aeson amazonka amazonka-cloudfront amazonka-core amazonka-s3
amazonka-sqs base bytestring cases conduit conduit-extra
contravariant cryptonite directory filepath firebase-login hasql
http-client http-types lens memory mime-types mtl pureMD5 random
resourcet servant servant-server servant-swagger servant-swagger-ui
swagger2 tagsoup temporary text time unliftio unordered-containers
wai wai-cors wai-lambda zip-archive
];
libraryToolDepends = [ hpack ];
executableHaskellDepends = [
aeson amazonka amazonka-cloudfront amazonka-core amazonka-s3
amazonka-sqs base bytestring cases conduit conduit-extra
contravariant cryptonite directory filepath firebase-login hasql
http-client http-client-tls http-types lens memory mime-types mtl
port-utils pureMD5 random resourcet servant servant-client
servant-server servant-swagger servant-swagger-ui swagger2 tagsoup
tasty tasty-hunit temporary text time unliftio unordered-containers
wai wai-cors wai-lambda warp zip-archive
];
prePatch = "hpack";
license = stdenv.lib.licenses.agpl3;
configureFlags = [
"--ghc-option=-optl=-static"
"--extra-lib-dirs=${pkgsMusl.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${pkgsMusl.zlib.static}/lib"
"--extra-lib-dirs=${pkgsMusl.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
];
}
4 changes: 4 additions & 0 deletions infra/handler/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ dependencies:

ghc-options:
- -Wall
- -optl
- -Wl,--start-group
- -lssl
- -lcrypto

library:
source-dirs: src
Expand Down
Loading