-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
86 lines (74 loc) · 2.14 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
pjass.url = "github:lep/pjass";
pjass.inputs.nixpkgs.follows = "nixpkgs";
pjass.inputs.flake-utils.follows = "flake-utils";
common-j.url = "github:lep/common-j";
common-j.inputs.nixpkgs.follows = "nixpkgs";
common-j.inputs.flake-utils.follows = "flake-utils";
wc3.url = "git+file:/Users/lep/dev/wc3-mapping";
wc3.inputs.nixpkgs.follows = "nixpkgs";
wc3.inputs.flake-utils.follows = "flake-utils";
wc3.inputs.common-j.follows = "common-j";
};
outputs = { self, nixpkgs, flake-utils, pjass, common-j, wc3 }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = import nixpkgs { inherit system; };
packageName = "lua2jass";
pjass-drv = pjass.defaultPackage.${system};
#wc3-shell = wc3.devShell.${system};
wc3-drv = wc3.packages.${system};
ghcPackages = pkgs.haskellPackages.ghcWithPackages (ps: [
ps.language-lua
ps.aeson
ps.optparse-applicative
ps.megaparsec
ps.parser-combinators
ps.file-embed
]);
pythonPackages = pkgs.python3.withPackages( ps: [
ps.tappy
]);
lua2jass = pkgs.stdenv.mkDerivation {
name = "lua2jass";
src = self;
buildPhase = ''
${ghcPackages}/bin/ghc -O Main.hs -o lua2jass
'';
installPhase = ''
mkdir -p $out/bin/
install -t $out/bin lua2jass
'';
};
in rec {
packages = {
${packageName} = lua2jass;
};
defaultPackage = packages.${packageName};
devShell = pkgs.mkShell {
env = {
commonj = "${common-j}/common.j";
};
shellHook = ''
function lli {
runhaskell compile.hs $1 | python interpreter.py /dev/stdin
}
'';
buildInputs = [
pythonPackages
ghcPackages
pkgs.cabal-install
pkgs.lua5_3_compat
pkgs.jq
pkgs.shellcheck
pjass-drv
wc3-drv.jhcr-start
wc3-drv.jhcr-update
wc3-drv.wc3
];
};
}
);
}