tvl-depot/users/glittershark/gws.fyi/default.nix
Griffin Smith 83a7eaa6fe feat(gws.fyi): Make website build easier to test
Expose website as a top-level attribute, and ignore index.html, both to
make test-deving the site easier

Change-Id: Ic056446e322ec5f69583d316998103883fc8d55b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2700
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2021-03-29 00:00:30 +00:00

31 lines
774 B
Nix

args@{ pkgs, ... }:
with pkgs;
let
site = import ./site.nix args;
resume = import ../resume args;
bucket = "s3://gws.fyi";
distributionID = "E2ST43JNBH8C64";
css = runCommand "main.css" {
buildInputs = [ pkgs.minify ];
} ''
minify --type css < ${./main.css} > $out
'';
website =
runCommand "gws.fyi" { } ''
mkdir -p $out
cp ${css} $out/main.css
cp ${site.index} $out/index.html
cp ${resume} $out/resume.pdf
'';
in (writeShellScript "deploy.sh" ''
${awscli}/bin/aws --profile personal s3 sync ${website}/ ${bucket}
${awscli}/bin/aws --profile personal cloudfront create-invalidation \
--distribution-id "${distributionID}" \
--paths "/*"
echo "Deployed to http://gws.fyi"
'') // {
inherit website;
}