git.iko.soy/rowtype-yoga/typeapp
on main help sign in
84 lines 2.8 kB history raw
1{
2 inputs = {
3 nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
4 utils.url = github:ursi/flake-utils;
5 hooks.url = github:cachix/git-hooks.nix;
6 purs-nix.url = github:purs-nix/purs-nix;
7 ps-tools.follows = "purs-nix/ps-tools";
8 option = {
9 url = "github:jmatsushita/purescript-option/8d0984";
10 flake = false;
11 };
12 };
14 outputs = { self, utils, ... }@inputs:
15 utils.apply-systems
16 { inherit inputs; }
17 ({ pkgs, system, ... }@ctx:
18 let
19 # frontend
20 inherit (pkgs) nodejs;
21 purs-nix = inputs.purs-nix { inherit system; };
22 inherit (ctx.ps-tools.for-0_15) purescript purs-tidy purescript-language-server;
23 # TODO use option from official index
24 option = purs-nix.build {
25 name = "option";
26 src.path = inputs.option;
27 info.dependencies = [ "aff" "argonaut-codecs" "argonaut-core" "codec" "codec-argonaut" "datetime" "effect" "either" "enums" "foldable-traversable" "foreign" "foreign-object" "functors" "identity" "lists" "maybe" "prelude" "record" "simple-json" "spec" "transformers" "tuples" "unsafe-coerce"];
28 };
29 dependencies =
30 with purs-nix.ps-pkgs;
31 [
32 prelude
33 option
34 ];
35 typeapp = purs-nix.build {
36 name = "typeapp";
37 src.path = ./.;
38 info = { inherit dependencies; };
39 };
40 ps =
41 purs-nix.purs
42 {
43 dir = ./.;
44 inherit dependencies;
45 inherit purescript nodejs;
46 };
47 # helpers
48 hooks = inputs.hooks.lib.${system}.run {
49 src = ./src;
50 hooks = {
51 # hook for frontend
52 purs-tidy = {
53 enable = true;
54 package = purs-tidy;
55 };
56 };
57 };
58 in
59 {
60 packages.default = typeapp;
62 devShells.default = pkgs.mkShell {
63 packages = with pkgs; [
64 # TODO remove compiled output from the repo
65 (ps.command { })
66 purescript-language-server
67 ];
68 shellHook = ''
69 ${hooks.shellHook}
70 shopt -s expand_aliases
71 alias log_='printf "\033[1;32m%s\033[0m\n" "$@"'
72 alias info_='printf "\033[1;34m[INFO] %s\033[0m\n" "$@"'
73 alias warn_='printf "\033[1;33m[WARN] %s\033[0m\n" "$@"'
75 log_ "Welcome to TypeApp shell."
76 info_ "Available commands: purs-nix"
77 '';
78 };
79 });
80 nixConfig = {
81 accept-flake-config = true;
82 extra-experimental-features = "nix-command flakes";
83 };