-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
110 lines (105 loc) · 3.24 KB
/
flake.nix
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
{
inputs =
{
purs-nix.url = "github:purs-nix/purs-nix";
nixpkgs.follows = "purs-nix/nixpkgs";
utils.url = "github:ursi/flake-utils";
ps-tools.follows = "purs-nix/ps-tools";
npmlock2nix = {
url = "github:nix-community/npmlock2nix";
flake = false;
};
httpurple-argonaut = {
url = "github:sigma-andex/purescript-httpurple-argonaut";
flake = false;
};
};
outputs = { self, utils, ... }@inputs:
utils.apply-systems
{
inherit inputs;
# Limited by ps-tools
systems = [ "x86_64-linux" "x86_64-darwin" ];
}
({ pkgs, system, ... }@ctx:
let
inherit (pkgs) nodejs;
npm = import inputs.npmlock2nix { inherit pkgs; };
node_modules = npm.v2.node_modules { src = ./.; inherit nodejs; } + /node_modules;
inherit (ctx.ps-tools) purescript purs-tidy purescript-language-server;
purs-nix = inputs.purs-nix { inherit system; };
affjax-node_ = pkgs.lib.recursiveUpdate purs-nix.ps-pkgs.affjax-node {
purs-nix-info.foreign."Affjax.Node" = { inherit node_modules; };
};
# TODO use httpurple-argonaut from official index
httpurple-argonaut_ = purs-nix.build
{
name = "httpurple-argonaut";
src.path = inputs.httpurple-argonaut;
info.dependencies = [ "argonaut" "console" "effect" "either" "httpurple" "prelude"];
};
ps =
purs-nix.purs
{
dir = ./.;
dependencies =
with purs-nix.ps-pkgs;
[
prelude
debug
aff
affjax-node_
argonaut-codecs
argonaut-generic
effect
httpurple
httpurple-argonaut_
test-unit
parsing
];
inherit purescript nodejs;
};
name = "purs-eval";
in
with ps;
rec {
apps.default =
{
type = "app";
program = "${packages.default}/bin/${name}";
};
packages =
{
default = app { inherit name; };
# npm version does not publish a nix-store path
npm = pkgs.runCommand
"purs-eval-npm"
{}
''
echo "#!/usr/bin/env node" > $out
tail -n +2 ${packages.default}/bin/purs-eval >> $out
'';
};
checks.test = test.check { };
devShells.default = pkgs.mkShell {
packages = with pkgs; [
nodejs
(ps.command { })
purescript-language-server
purs-tidy
purescript
purs-nix.esbuild
];
};
}
);
nixConfig = {
extra-experimental-features = "nix-command flakes";
extra-substituters = [
"https://klarkc.cachix.org"
];
extra-trusted-public-keys = [
"klarkc.cachix.org-1:R+z+m4Cq0hMgfZ7AQ42WRpGuHJumLLx3k0XhwpNFq9U="
];
};
}