-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathflake.nix
More file actions
148 lines (132 loc) · 4.23 KB
/
flake.nix
File metadata and controls
148 lines (132 loc) · 4.23 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
{
description = "Harmony programming language compiler and model checker";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in
{
packages = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
# Pin to a known-good Python for Harmony + ANTLR 4.9.3.
python = pkgs.python311;
pyPkgs = python.pkgs;
harmonyVersion =
if (self ? rev) && (self.rev != null) then
"0.0.0+git.${builtins.substring 0 7 self.rev}"
else if (self ? lastModifiedDate) then
"0.0.0+${self.lastModifiedDate}"
else
"0.0.0";
antlr4-python3-runtime = pyPkgs.buildPythonPackage rec {
pname = "antlr4-python3-runtime";
version = "4.9.3";
src = pkgs.fetchPypi {
inherit pname version;
hash = "sha256-8iRGm0FoKUkCux76gKi/eFXyTJmu+Zy+/BvNPM53iBs=";
};
format = "setuptools";
doCheck = false;
};
antlr-denter = pyPkgs.buildPythonPackage {
pname = "antlr-denter";
version = "1.3.1";
# The sdist's setup.py expects a README.md outside the source root.
# Use the wheel instead.
src = pkgs.fetchurl {
url = "https://files.pythonhosted.org/packages/0b/7d/90b9b27e51099deff45ae426157332c8d29448c62df0036efaa28ef3c27b/antlr_denter-1.3.1-py3-none-any.whl";
hash = "sha256-FaMtw5Il3rW0B5aPyaN7eNYJbFuSGJH3tO31OG6Tjho=";
};
format = "wheel";
propagatedBuildInputs = [ antlr4-python3-runtime ];
doCheck = false;
};
automata-lib = pyPkgs.buildPythonPackage rec {
pname = "automata-lib";
version = "5.0.0";
src = pkgs.fetchPypi {
inherit pname version;
hash = "sha256-YMUmtNrWes4rile5OlPTi2UEBQsAiEXKclRa/ZvnuQw=";
};
format = "setuptools";
doCheck = false;
};
in
rec {
harmony = pyPkgs.buildPythonPackage {
pname = "harmony";
version = harmonyVersion;
src = self;
format = "setuptools";
# setup.py reads harmony_model_checker/__init__.py for __version__.
postPatch = ''
cat > harmony_model_checker/__init__.py <<'EOF'
__package__ = "harmony_model_checker"
__version__ = "${harmonyVersion}"
EOF
'';
nativeBuildInputs = [
pyPkgs.setuptools
pyPkgs.wheel
];
propagatedBuildInputs = [
pkgs.graphviz
antlr-denter
antlr4-python3-runtime
automata-lib
pyPkgs.pydot
pyPkgs.requests
];
doCheck = false;
pythonImportsCheck = [
"harmony_model_checker"
"harmony_model_checker.charm"
];
meta = with pkgs.lib; {
description = "Harmony programming language compiler and model checker";
homepage = "https://harmony.cs.cornell.edu";
license = licenses.bsd3;
mainProgram = "harmony";
};
};
default = harmony;
}
);
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/harmony";
};
});
devShells = forAllSystems (
system:
let
pkgs = import nixpkgs { inherit system; };
python = pkgs.python311;
in
{
default = pkgs.mkShell {
packages = [
(python.withPackages (ps: [
ps.pydot
ps.requests
]))
pkgs.graphviz
pkgs.stdenv.cc
];
};
}
);
};
}