Skip to content

Instantly share code, notes, and snippets.

@Rizary
Created April 29, 2018 03:40
Show Gist options
  • Save Rizary/10b6b2f51f4681cb3e51568dd222ea1a to your computer and use it in GitHub Desktop.
Save Rizary/10b6b2f51f4681cb3e51568dd222ea1a to your computer and use it in GitHub Desktop.
{ nixpkgs ? import <nixpkgs> {}
}:
let
inherit (nixpkgs) pkgs;
activate = pkgs.writeScriptBin "activate" ''
#!${pkgs.bash}/bin/bash -e
'';
frontend = import ./frontend {};
backend = import ./backend {};
in
pkgs.stdenv.mkDerivation rec {
name = "qoeifs-app";
src = ./.;
env = pkgs.buildEnv { name = name; paths = buildInputs; };
installPhase = ''
mkdir -p $out/prod/static
cp -rf ${frontend}/ghcjs/frontend/bin/frontend-exe.jsexe/* $out/prod/static/
cp -r ./static/test.css $out/prod/static
cp -rf ${backend.package}/lib/node_modules/backend/result/lib/node_modules/backend/* $out/prod/
mkdir -p $out/bin
ln -sv ${activate}/bin/activate $out/bin/
'';
phases = ["unpackPhase" "installPhase"];
buildInputs = [ frontend backend pkgs.nodePackages.nodemon];
}
{ nixpkgs ? import <nixpkgs> {}}:
let
inherit (nixpkgs) pkgs;
app = import ./default.nix {};
in
app.env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment