-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
72 lines (66 loc) · 2.04 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
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
purifix.url = "github:purifix/purifix";
purescript-overlay = {
url = "github:thomashoneyman/purescript-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs =
(nixpkgs.legacyPackages.${system}.extend inputs.purifix.overlay).extend
inputs.purescript-overlay.overlays.default;
mirosProject = pkgs.purifix { src = ./.; };
deps = [
pkgs.stylua
pkgs.nodejs
];
evaluate = "import {main} from 'file://$out/output/Main/index.js'; main();";
in
rec {
packages.miros = pkgs.symlinkJoin {
inherit (mirosProject.run) name meta;
paths = [ mirosProject ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
mkdir -p $out/bin
echo "#!${pkgs.runtimeShell}" >> $out/bin/miros
echo "node \
--input-type=module \
--abort-on-uncaught-exception \
--trace-sigint \
--trace-uncaught \
--eval=\"${evaluate}\" -- \"\$@"\" >> $out/bin/miros
chmod +x $out/bin/miros
wrapProgram $out/bin/miros \
--prefix PATH : ${pkgs.lib.makeBinPath deps}
'';
};
packages.default = packages.miros;
packages.miros-nvim = pkgs.vimUtils.buildVimPlugin {
name = "miros-nvim";
src = ./vim;
};
devShells.default =
with pkgs;
mkShell {
buildInputs = [
nodePackages_latest.typescript
nodePackages_latest.ts-node
nodejs
purs
spago-unstable
purs-tidy-bin.purs-tidy-0_10_0
purs-backend-es
purescript-language-server
];
};
}
);
}