Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
zeme-wana committed Nov 23, 2022
1 parent 8e418df commit 290df7c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bitte/default.nix
@@ -0,0 +1,10 @@
{ docs, pkgs }:
let
staticSite = pkgs.callPackage ./static-site.nix { };
playgroundStatic = pkgs.callPackage ./playground-static.nix { inherit staticSite; docs = docs.site; };
in
{
plutus-playground-client-entrypoint = playgroundStatic {
variant = "plutus";
};
}
11 changes: 11 additions & 0 deletions bitte/playground-static.nix
@@ -0,0 +1,11 @@
{ staticSite, linkFarm, symlinkJoin, docs }:
let
shiftedDocs = linkFarm docs.name [{ name = "doc"; path = docs; }];
in
{ variant }: staticSite {
root = (symlinkJoin {
name = "${variant}-playground-client-and-docs";
paths = [ shiftedDocs ];
});
port-name = "${variant}_playground_client";
}
28 changes: 28 additions & 0 deletions bitte/static-site.nix
@@ -0,0 +1,28 @@
# Needed variables:
# NOMAD_PORT_${port-name}
# NOMAD_IP_${port-name}
{ writeShellScriptBin, symlinkJoin, lib, writeText, lighttpd }: { root, port-name }:

let
config = writeText "lighttpd.conf" ''
server.modules = ("mod_deflate")
server.document-root = "${root}"
server.port = env.NOMAD_PORT_${port-name}
server.bind = env.NOMAD_IP_${port-name}
index-file.names = ("index.html")
mimetype.assign = (
".css" => "text/css",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".html" => "text/html",
".js" => "text/javascript",
".svg" => "image/svg+xml",
)
deflate.cache-dir = "/tmp"
deflate.mimetypes = ("text/plain", "text/html", "text/css")
server.upload-dirs = ("/tmp")
'';
in
writeShellScriptBin "entrypoint" ''
exec -a lighttpd ${lighttpd}/bin/lighttpd -f ${config} -D
''
3 changes: 3 additions & 0 deletions default.nix
Expand Up @@ -71,4 +71,7 @@ rec {
devcontainer = import ./nix/devcontainer/plutus-devcontainer.nix { inherit pkgs plutus-apps; };

build-and-push-devcontainer-script = import ./nix/devcontainer/deploy/default.nix { inherit pkgs plutus-apps; };

# Packages needed for the bitte deployment
bitte-packages = import ./bitte { inherit docs pkgs; };
}

0 comments on commit 290df7c

Please sign in to comment.