prepare for serving in docker
This commit is contained in:
parent
4c848455b5
commit
82cf960ccd
|
@ -1,7 +1,8 @@
|
||||||
{ system ? builtins.currentSystem }:
|
{ system ? builtins.currentSystem }:
|
||||||
|
|
||||||
let
|
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;
|
callPackage = pkgs.lib.callPackageWith pkgs;
|
||||||
site = callPackage ./site.nix { };
|
site = callPackage ./site.nix { };
|
||||||
|
|
||||||
|
@ -10,11 +11,12 @@ let
|
||||||
name = "xena/christinewebsite";
|
name = "xena/christinewebsite";
|
||||||
tag = "latest";
|
tag = "latest";
|
||||||
|
|
||||||
contents = [ pkgs.cacert ];
|
contents = [ pkg ];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
Cmd = [ "${pkg}/bin/xesite" ];
|
Cmd = [ "${pkg}/bin/xesite" ];
|
||||||
WorkingDir = "${pkg}/";
|
Env = [ "CONFIG_FNAME=${pkg}/config.dhall" "RUST_LOG=info" ];
|
||||||
|
WorkingDir = "/";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
cd "$(dirname "$0")"/..
|
|
||||||
./bin/site
|
|
21
site.nix
21
site.nix
|
@ -6,24 +6,39 @@ let
|
||||||
builtins.filterSource
|
builtins.filterSource
|
||||||
(path: type: type != "directory" || builtins.baseNameOf path != "target")
|
(path: type: type != "directory" || builtins.baseNameOf path != "target")
|
||||||
dir;
|
dir;
|
||||||
|
|
||||||
naersk = pkgs.callPackage sources.naersk { };
|
naersk = pkgs.callPackage sources.naersk { };
|
||||||
gruvbox-css = pkgs.callPackage sources.gruvbox-css { };
|
dhallpkgs = import sources.easy-dhall-nix { inherit pkgs; };
|
||||||
src = srcNoTarget ./.;
|
src = srcNoTarget ./.;
|
||||||
|
|
||||||
xesite = naersk.buildPackage {
|
xesite = naersk.buildPackage {
|
||||||
inherit src;
|
inherit src;
|
||||||
buildInputs = [ pkg-config openssl ];
|
buildInputs = [ pkg-config openssl ];
|
||||||
remapPathPrefix = true;
|
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 {
|
in pkgs.stdenv.mkDerivation {
|
||||||
inherit (xesite) name;
|
inherit (xesite) name;
|
||||||
inherit src;
|
inherit src;
|
||||||
phases = "installPhase";
|
phases = "installPhase";
|
||||||
|
|
||||||
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/blog $out/blog
|
||||||
cp -rf $src/css $out/css
|
cp -rf $src/css $out/css
|
||||||
cp -rf $src/gallery $out/gallery
|
cp -rf $src/gallery $out/gallery
|
||||||
|
|
|
@ -135,7 +135,7 @@ async fn main() -> Result<()> {
|
||||||
.with(warp::log(APPLICATION_NAME))
|
.with(warp::log(APPLICATION_NAME))
|
||||||
.recover(handlers::rejection);
|
.recover(handlers::rejection);
|
||||||
|
|
||||||
warp::serve(site).run(([127, 0, 0, 1], 3030)).await;
|
warp::serve(site).run(([0, 0, 0, 0], 3030)).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue