git.iko.soy/rowtype-yoga/purs-eval
on main help sign in
110 lines 3.3 kB history raw
1{
2 inputs =
3 {
4 purs-nix.url = "github:purs-nix/purs-nix";
5 nixpkgs.follows = "purs-nix/nixpkgs";
6 utils.url = "github:ursi/flake-utils";
7 ps-tools.follows = "purs-nix/ps-tools";
8 npmlock2nix = {
9 url = "github:nix-community/npmlock2nix";
10 flake = false;
11 };
12 httpurple-argonaut = {
13 url = "github:sigma-andex/purescript-httpurple-argonaut";
14 flake = false;
15 };
16 };
18 outputs = { self, utils, ... }@inputs:
19 utils.apply-systems
20 {
21 inherit inputs;
22 # Limited by ps-tools
23 systems = [ "x86_64-linux" "x86_64-darwin" ];
24 }
25 ({ pkgs, system, ... }@ctx:
26 let
27 inherit (pkgs) nodejs;
28 npm = import inputs.npmlock2nix { inherit pkgs; };
29 node_modules = npm.v2.node_modules { src = ./.; inherit nodejs; } + /node_modules;
30 inherit (ctx.ps-tools) purescript purs-tidy purescript-language-server;
31 purs-nix = inputs.purs-nix { inherit system; };
32 affjax-node_ = pkgs.lib.recursiveUpdate purs-nix.ps-pkgs.affjax-node {
33 purs-nix-info.foreign."Affjax.Node" = { inherit node_modules; };
34 };
35 # TODO use httpurple-argonaut from official index
36 httpurple-argonaut_ = purs-nix.build
37 {
38 name = "httpurple-argonaut";
39 src.path = inputs.httpurple-argonaut;
40 info.dependencies = [ "argonaut" "console" "effect" "either" "httpurple" "prelude"];
41 };
42 ps =
43 purs-nix.purs
44 {
45 dir = ./.;
46 dependencies =
47 with purs-nix.ps-pkgs;
48 [
49 prelude
50 debug
51 aff
52 affjax-node_
53 argonaut-codecs
54 argonaut-generic
55 effect
56 httpurple
57 httpurple-argonaut_
58 test-unit
59 parsing
60 ];
61 inherit purescript nodejs;
62 };
63 name = "purs-eval";
64 in
65 with ps;
66 rec {
67 apps.default =
68 {
69 type = "app";
70 program = "${packages.default}/bin/${name}";
71 };
73 packages =
74 {
75 default = app { inherit name; };
76 # npm version does not publish a nix-store path
77 npm = pkgs.runCommand
78 "purs-eval-npm"
79 {}
80 ''
81 echo "#!/usr/bin/env node" > $out
82 tail -n +2 ${packages.default}/bin/purs-eval >> $out
83 '';
84 };
86 checks.test = test.check { };
88 devShells.default = pkgs.mkShell {
89 packages = with pkgs; [
90 nodejs
91 (ps.command { })
92 purescript-language-server
93 purs-tidy
94 purescript
95 purs-nix.esbuild
96 ];
97 };
98 }
99 );
101 nixConfig = {
102 extra-experimental-features = "nix-command flakes";
103 extra-substituters = [
104 "https://klarkc.cachix.org"
105 ];
106 extra-trusted-public-keys = [
107 "klarkc.cachix.org-1:R+z+m4Cq0hMgfZ7AQ42WRpGuHJumLLx3k0XhwpNFq9U="
108 ];
109 };