git.iko.soy/typeable/octopod
on iko/CI help sign in
typeable/octopod/default.nix
83 lines 2.7 kB history raw
1{ sources ? import ./nix/sources.nix
2, haskellNix ? import sources.haskellNix { inherit system; }
3, pkgsSrc ? import haskellNix.sources.nixpkgs-2105
4, pkgs ? pkgsSrc (haskellNix.nixpkgsArgs // { inherit system; })
5, nix-filter ? import sources.nix-filter
6, system ? builtins.currentSystem
7, prod ? false
8}:
9let
10 octopod-css = import ./octopod-css { inherit pkgsSrc; };
11 insaneOptimizationFlags = [
12 "-O2"
13 "-fexpose-all-unfoldings"
14 "-fspecialise-aggressively"
15 ];
16 addLocalOptions = x:
17 if prod then x // {
18 ghcOptions = [ "-Werror" ] ++ insaneOptimizationFlags;
19 }
20 else x // { ghcOptions = [ "-O0" ]; };
22 hsPkgs = pkgs.haskell-nix.cabalProject {
23 src = nix-filter {
24 root = ./.;
25 name = "octopod";
26 include = [
27 ./octopod-backend/octopod-backend.cabal
28 ./octo-cli/octo-cli.cabal
29 ./octopod-api/octopod-api.cabal
30 ./octopod-common/octopod-common.cabal
31 ./octopod-frontend/octopod-frontend.cabal
32 ./cabal.project
33 ];
34 };
36 modules = [
37 {
38 ghcOptions = insaneOptimizationFlags;
39 dontStrip = false;
40 dontPatchELF = false;
41 enableDeadCodeElimination = true;
42 packages.octopod-backend = addLocalOptions (
43 if prod
44 then {
45 src = pkgs.runCommand "octopod-backend-src" { }
46 ''
47 mkdir -p $out
48 cp -r ${./octopod-backend}/* $out
49 cp -r ${builtins.path { path = ./.git; name = "dot-git"; }}/ $out/.git/
50 '';
51 components.exes.octopod-exe = {
52 build-tools =
53 pkgs.lib.mkForce [ pkgs.buildPackages.buildPackages.gitReallyMinimal ];
54 extraSrcFiles = [ ".git/**/*" ];
55 };
56 }
57 else { src = ./octopod-backend; }
58 );
59 packages.octo-cli = addLocalOptions { src = ./octo-cli; };
60 packages.octopod-api = addLocalOptions { src = ./octopod-api; };
61 packages.octopod-frontend = addLocalOptions { src = ./octopod-frontend; };
62 packages.octopod-common = addLocalOptions { src = ./octopod-common; };
63 }
64 ];
66 index-state = "2021-11-22T00:00:00Z";
67 compiler-nix-name = "ghc8107";
68 };
69in
70hsPkgs // {
71 octopod-frontend-pretty =
72 let frontend = hsPkgs.projectCross.ghcjs.hsPkgs.octopod-frontend.components.exes.frontend;
73 in
74 pkgs.runCommand "octopod-frontend-pretty"
75 { } ''
76 mkdir $out
77 cp -av ${octopod-css}/* $out
78 cp ${./octopod-frontend/index.html} $out/index.html
79 cp ${frontend}/bin/frontend.jsexe/all.js $out/all.js
80 cp ${frontend}/bin/frontend.jsexe/all.js.externs $out/all.js.externs
81 '';
82 inherit pkgsSrc;