prepare for serving in docker

This commit is contained in:
Cadey Ratio 2020-07-14 17:40:11 -04:00
parent 4c848455b5
commit 82cf960ccd
4 changed files with 24 additions and 11 deletions

View File

@ -1,7 +1,8 @@
{ system ? builtins.currentSystem }:
let
pkgs = import (import ./nix/sources.nix).nixpkgs { inherit system; };
sources = import ./nix/sources.nix;
pkgs = import sources.nixpkgs { inherit system; };
callPackage = pkgs.lib.callPackageWith pkgs;
site = callPackage ./site.nix { };
@ -10,11 +11,12 @@ let
name = "xena/christinewebsite";
tag = "latest";
contents = [ pkgs.cacert ];
contents = [ pkg ];
config = {
Cmd = [ "${pkg}/bin/xesite" ];
WorkingDir = "${pkg}/";
Env = [ "CONFIG_FNAME=${pkg}/config.dhall" "RUST_LOG=info" ];
WorkingDir = "/";
};
};

View File

@ -1,4 +0,0 @@
#!/bin/sh
cd "$(dirname "$0")"/..
./bin/site

View File

@ -6,24 +6,39 @@ let
builtins.filterSource
(path: type: type != "directory" || builtins.baseNameOf path != "target")
dir;
naersk = pkgs.callPackage sources.naersk { };
gruvbox-css = pkgs.callPackage sources.gruvbox-css { };
dhallpkgs = import sources.easy-dhall-nix { inherit pkgs; };
src = srcNoTarget ./.;
xesite = naersk.buildPackage {
inherit src;
buildInputs = [ pkg-config openssl ];
remapPathPrefix = true;
};
config = stdenv.mkDerivation {
pname = "xesite-config";
version = "HEAD";
buildInputs = [ dhallpkgs.dhall-simple ];
phases = "installPhase";
installPhase = ''
cd ${src}
dhall resolve < ${src}/config.dhall >> $out
'';
};
in pkgs.stdenv.mkDerivation {
inherit (xesite) name;
inherit src;
phases = "installPhase";
installPhase = ''
mkdir -p $out $out/blog $out/css $out/gallery $out/static $out/talks $out/bin
mkdir -p $out $out/bin
cp -rf $src/config.dhall $out/config.dhall
cp -rf ${config} $out/config.dhall
cp -rf $src/blog $out/blog
cp -rf $src/css $out/css
cp -rf $src/gallery $out/gallery

View File

@ -135,7 +135,7 @@ async fn main() -> Result<()> {
.with(warp::log(APPLICATION_NAME))
.recover(handlers::rejection);
warp::serve(site).run(([127, 0, 0, 1], 3030)).await;
warp::serve(site).run(([0, 0, 0, 0], 3030)).await;
Ok(())
}