2020-12-09 16:20:24 +03:00
|
|
|
{ sources ? import ./nix/sources.nix
|
2021-07-26 18:16:45 +03:00
|
|
|
, haskellNix ? import sources.haskellNix { inherit system; }
|
2021-08-20 19:31:28 +03:00
|
|
|
, pkgsSrc ? import haskellNix.sources.nixpkgs-2105
|
|
|
|
, pkgs ? pkgsSrc (haskellNix.nixpkgsArgs // { inherit system; })
|
2021-07-26 18:16:45 +03:00
|
|
|
, nix-filter ? import sources.nix-filter
|
|
|
|
, system ? builtins.currentSystem
|
2021-09-02 16:46:41 +03:00
|
|
|
, prod ? false
|
2020-12-09 16:20:24 +03:00
|
|
|
}:
|
2021-07-13 11:53:53 +03:00
|
|
|
let
|
2021-08-20 19:31:28 +03:00
|
|
|
octopod-css = import ./octopod-css { inherit pkgsSrc; };
|
2021-09-02 16:46:41 +03:00
|
|
|
addLocalOptions = x:
|
|
|
|
if prod then x // { ghcOptions = [ "-Werror" ]; }
|
|
|
|
else x // { ghcOptions = [ "-O0" ]; };
|
2021-08-20 19:31:28 +03:00
|
|
|
|
2021-07-13 11:53:53 +03:00
|
|
|
hsPkgs = pkgs.haskell-nix.cabalProject {
|
2021-07-26 18:16:45 +03:00
|
|
|
src = nix-filter {
|
|
|
|
root = ./.;
|
2021-07-13 11:53:53 +03:00
|
|
|
name = "octopod";
|
2021-07-26 18:16:45 +03:00
|
|
|
include = [
|
|
|
|
./octopod-backend/octopod-backend.cabal
|
|
|
|
./octo-cli/octo-cli.cabal
|
|
|
|
./octopod-api/octopod-api.cabal
|
|
|
|
./octopod-common/octopod-common.cabal
|
|
|
|
./octopod-frontend/octopod-frontend.cabal
|
|
|
|
./cabal.project
|
|
|
|
];
|
2020-12-11 16:31:46 +03:00
|
|
|
};
|
2021-07-26 18:16:45 +03:00
|
|
|
|
|
|
|
modules = [
|
|
|
|
{
|
2021-09-02 16:46:41 +03:00
|
|
|
ghcOptions = [ "-O2" ];
|
2021-07-26 18:16:45 +03:00
|
|
|
dontStrip = false;
|
|
|
|
dontPatchELF = false;
|
|
|
|
enableDeadCodeElimination = true;
|
2021-09-26 19:36:10 +03:00
|
|
|
packages.octopod-backend = addLocalOptions (
|
|
|
|
if prod
|
|
|
|
then {
|
|
|
|
src = pkgs.runCommand "octopod-backend-src" { }
|
|
|
|
''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r ${./octopod-backend}/* $out
|
|
|
|
cp -r ${builtins.path { path = ./.git; name = "dot-git"; }}/ $out/.git/
|
|
|
|
'';
|
|
|
|
components.exes.octopod-exe = {
|
|
|
|
build-tools =
|
|
|
|
pkgs.lib.mkForce [ pkgs.buildPackages.buildPackages.gitReallyMinimal ];
|
|
|
|
extraSrcFiles = [ ".git/**/*" ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
else { src = ./octopod-backend; }
|
|
|
|
);
|
2021-09-02 16:46:41 +03:00
|
|
|
packages.octo-cli = addLocalOptions { src = ./octo-cli; };
|
|
|
|
packages.octopod-api = addLocalOptions { src = ./octopod-api; };
|
|
|
|
packages.octopod-frontend = addLocalOptions { src = ./octopod-frontend; };
|
|
|
|
packages.octopod-common = addLocalOptions { src = ./octopod-common; };
|
2021-07-26 18:16:45 +03:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2021-08-26 18:14:29 +03:00
|
|
|
index-state = "2021-08-04T00:00:00Z";
|
2021-07-13 11:53:53 +03:00
|
|
|
compiler-nix-name = "ghc8105";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
hsPkgs // {
|
|
|
|
octopod-frontend-pretty =
|
2021-08-05 18:18:06 +03:00
|
|
|
let frontend = hsPkgs.projectCross.ghcjs.hsPkgs.octopod-frontend.components.exes.frontend;
|
|
|
|
in
|
2021-07-13 11:53:53 +03:00
|
|
|
pkgs.runCommand "octopod-frontend-pretty"
|
|
|
|
{ } ''
|
|
|
|
mkdir $out
|
2021-08-20 19:31:28 +03:00
|
|
|
cp -av ${octopod-css}/* $out
|
2021-07-13 11:53:53 +03:00
|
|
|
cp ${./octopod-frontend/index.html} $out/index.html
|
2021-08-05 18:18:06 +03:00
|
|
|
cp ${frontend}/bin/frontend.jsexe/all.js $out/all.js
|
|
|
|
cp ${frontend}/bin/frontend.jsexe/all.js.externs $out/all.js.externs
|
2021-07-13 11:53:53 +03:00
|
|
|
'';
|
2021-08-20 19:31:28 +03:00
|
|
|
inherit pkgsSrc;
|
2021-07-13 11:53:53 +03:00
|
|
|
}
|