summaryrefslogtreecommitdiff
path: root/flake.nix
blob: cb056190671f7d6dce9331cf9b1a3e1f09f68ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
{
  description = "bundt - frontend for fig";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    ps-tools.follows = "purs-nix/ps-tools";
    purs-nix.url = "github:purs-nix/purs-nix/ps-0.15";
    newton = {
      url = "github:lcolonq/newton";
    };
  };

  outputs = { self, nixpkgs, ... }@inputs:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
      ps-tools = inputs.ps-tools.legacyPackages.${system};
      purs-nix = inputs.purs-nix { inherit system; };

      NEWTON_PATH = inputs.newton.packages.${system}.wasm.throwshade;

      purescript = purs-nix.purs {
        dependencies = [
          "console"
          "effect"
          "prelude"
          "random"
          "refs"
          "web-html"
          "web-dom"
          "web-uievents"
          "web-xhr"
          "canvas"
          "argonaut"
          "fetch"
          "fetch-argonaut"
        ];
        dir = ./.;
        srcs = [ "src" ];
      };
      bundt = purescript.bundle {};

      bundleAPI = pkgs.stdenv.mkDerivation  {
        name = "bundt-bundle-api";
        src = ./.;
        inherit NEWTON_PATH;
        buildInputs = [
          (purescript.command {})
          pkgs.m4
        ];
        buildPhase = "
          make deploy_api
        ";
        installPhase = ''
          mkdir -p $out
          cp -r dist/api/deploy/* $out/
        '';
      };
      bundleAuth = pkgs.stdenv.mkDerivation  {
        name = "bundt-bundle-auth";
        src = ./.;
        buildInputs = [
          (purescript.command {})
          pkgs.m4
        ];
        buildPhase = "
          make deploy_auth
        ";
        installPhase = ''
          mkdir -p $out
          cp -r dist/auth/deploy/* $out/
        '';
      };
      bundleGreencircle = pkgs.stdenv.mkDerivation  {
        name = "bundt-bundle-greencircle";
        src = ./.;
        buildInputs = [
          (purescript.command {})
          pkgs.m4
        ];
        buildPhase = "
          make deploy_greencircle
        ";
        installPhase = ''
          mkdir -p $out
          cp -r dist/greencircle/deploy/* $out/
        '';
      };
    in {
      devShells.x86_64-linux.default = pkgs.mkShell {
        inherit NEWTON_PATH;
        buildInputs = [
          pkgs.nodejs
          (purescript.command {})
          ps-tools.for-0_15.purescript-language-server
          purs-nix.esbuild
          purs-nix.purescript
          pkgs.m4
          pkgs.dhall
          pkgs.dhall-json
        ];
      };
      packages.x86_64-linux = {
        default = bundt;
        inherit
          bundleAPI
          bundleAuth
          bundleGreencircle
        ;
      };
      overlay = self: super: {
        bundt = {
          inherit
            bundleAPI
            bundleAuth
            bundleGreencircle
          ;
        };
      };
    };
}