tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
scyther: Separated into two derivations
Silvan Mosberger
8 years ago
313b8b7e
75fde413
+91
-62
3 changed files
expand all
collapse all
unified
split
pkgs
applications
science
programming
scyther
cli.nix
default.nix
top-level
all-packages.nix
+32
pkgs/applications/science/programming/scyther/cli.nix
···
1
1
+
{ stdenv, glibc, flex, bison, cmake
2
2
+
, version, src, meta }:
3
3
+
stdenv.mkDerivation {
4
4
+
name = "scyther-cli-${version}";
5
5
+
6
6
+
inherit src meta;
7
7
+
8
8
+
buildInputs = [
9
9
+
cmake
10
10
+
glibc.static
11
11
+
flex
12
12
+
bison
13
13
+
];
14
14
+
15
15
+
patchPhase = ''
16
16
+
# Since we're not in a git dir, the normal command this project uses to create this file wouldn't work
17
17
+
printf "%s\n" "#define TAGVERSION \"${version}\"" > src/version.h
18
18
+
'';
19
19
+
20
20
+
configurePhase = ''
21
21
+
(cd src && cmakeConfigurePhase)
22
22
+
'';
23
23
+
24
24
+
dontUseCmakeBuildDir = true;
25
25
+
cmakeFlags = [ "-DCMAKE_C_FLAGS=-std=gnu89" ];
26
26
+
27
27
+
installPhase = ''
28
28
+
mkdir -p "$out/bin"
29
29
+
mv src/scyther-linux "$out/bin/scyther-cli"
30
30
+
ln -s "$out/bin/scyther-cli" "$out/bin/scyther-linux"
31
31
+
'';
32
32
+
}
+58
-61
pkgs/applications/science/programming/scyther/default.nix
···
1
1
-
{ stdenv, lib, fetchFromGitHub, glibc, flex, bison, python27Packages, graphviz, cmake
1
1
+
{ stdenv, lib, buildEnv, callPackage_i686, fetchFromGitHub, python27Packages, graphviz
2
2
, includeGUI ? true
3
3
, includeProtocols ? true
4
4
}:
5
5
let
6
6
version = "1.1.3";
7
7
-
in
8
8
-
stdenv.mkDerivation {
9
9
-
name = "scyther-${version}";
7
7
+
10
8
src = fetchFromGitHub {
11
9
rev = "v${version}";
12
10
sha256 = "0rb4ha5bnjxnwj4f3hciq7kyj96fhw14hqbwl5kr9cdw8q62mx0h";
···
14
12
repo = "scyther";
15
13
};
16
14
17
17
-
buildInputs = [
18
18
-
cmake
19
19
-
glibc.static
20
20
-
flex
21
21
-
bison
22
22
-
] ++ lib.optional includeGUI [
23
23
-
python27Packages.wrapPython
24
24
-
];
15
15
+
meta = with lib; {
16
16
+
description = "Scyther is a tool for the automatic verification of security protocols.";
17
17
+
homepage = https://www.cs.ox.ac.uk/people/cas.cremers/scyther/;
18
18
+
license = licenses.gpl2;
19
19
+
maintainers = with maintainers; [ infinisil ];
20
20
+
platforms = platforms.linux;
21
21
+
};
25
22
26
26
-
patchPhase = ''
27
27
-
# Since we're not in a git dir, the normal command this project uses to create this file wouldn't work
28
28
-
printf "%s\n" "#define TAGVERSION \"${version}\"" > src/version.h
29
29
-
'' + lib.optionalString includeGUI ''
30
30
-
file=gui/Scyther/Scyther.py
31
31
-
32
32
-
# By default the scyther binary is looked for in the directory of the python script ($out/gui), but we want to have it look where our cli package is
33
33
-
substituteInPlace $file --replace "return getMyDir()" "return \"$out/bin\""
23
23
+
cli = callPackage_i686 ./cli.nix {
24
24
+
inherit version src meta;
25
25
+
};
34
26
35
35
-
# Removes the Shebang from the file, as this would be wrapped wrongly
36
36
-
sed -i -e "1d" $file
37
37
-
'';
27
27
+
gui = stdenv.mkDerivation {
28
28
+
name = "scyther-gui-${version}";
29
29
+
inherit src meta;
30
30
+
buildInputs = [
31
31
+
python27Packages.wrapPython
32
32
+
];
38
33
39
39
-
configurePhase = ''
40
40
-
(cd src && cmakeConfigurePhase)
41
41
-
'';
34
34
+
patchPhase = ''
35
35
+
file=gui/Scyther/Scyther.py
42
36
43
43
-
propagatedBuildInputs = lib.optional includeGUI [
44
44
-
python27Packages.wxPython
45
45
-
graphviz
46
46
-
];
47
47
-
48
48
-
dontUseCmakeBuildDir = true;
49
49
-
cmakeFlags = [ "-DCMAKE_C_FLAGS=-std=gnu89" ];
37
37
+
# By default the scyther binary is looked for in the directory of the python script ($out/gui), but we want to have it look where our cli package is
38
38
+
substituteInPlace $file --replace "return getMyDir()" "return \"${cli}/bin\""
39
39
+
40
40
+
# Removes the Shebang from the file, as this would be wrapped wrongly
41
41
+
sed -i -e "1d" $file
42
42
+
'';
50
43
51
51
-
installPhase = ''
52
52
-
mkdir -p "$out/bin"
53
53
-
cp src/scyther-linux "$out/bin/scyther-cli"
54
54
-
'' + lib.optionalString includeGUI ''
55
55
-
mkdir -p "$out/gui"
56
56
-
cp -r gui/* "$out/gui"
57
57
-
ln -s ../gui/scyther-gui.py "$out/bin/scyther-gui"
58
58
-
ln -s ../bin/scyther-cli "$out/bin/scyther-linux"
59
59
-
'' + lib.optionalString includeProtocols (if includeGUI then ''
60
60
-
ln -s ./gui/Protocols "$out/protocols"
61
61
-
'' else ''
62
62
-
mkdir -p "$out/protocols"
63
63
-
cp -r gui/Protocols/* "$out/protocols"
64
64
-
'');
44
44
+
dontBuild = true;
65
45
66
66
-
postFixup = lib.optionalString includeGUI ''
67
67
-
wrapPythonProgramsIn "$out/gui" "$out $pythonPath"
68
68
-
'';
46
46
+
propagatedBuildInputs = [
47
47
+
python27Packages.wxPython
48
48
+
graphviz
49
49
+
];
50
50
+
51
51
+
installPhase = ''
52
52
+
mkdir -p "$out"/gui "$out"/bin
53
53
+
cp -r gui/* "$out"/gui
54
54
+
ln -s "$out"/gui/scyther-gui.py "$out/bin/scyther-gui"
55
55
+
'';
69
56
70
70
-
doInstallCheck = includeGUI;
71
71
-
installCheckPhase = ''
72
72
-
"$out/gui/scyther.py" "$src/gui/Protocols/Demo/ns3.spdl"
73
73
-
'';
57
57
+
postFixup = ''
58
58
+
wrapPythonProgramsIn "$out/gui" "$out $pythonPath"
59
59
+
'';
74
60
75
75
-
meta = with lib; {
76
76
-
description = "Scyther is a tool for the automatic verification of security protocols.";
77
77
-
homepage = https://www.cs.ox.ac.uk/people/cas.cremers/scyther/;
78
78
-
license = licenses.gpl2;
79
79
-
maintainers = with maintainers; [ infinisil ];
80
80
-
platforms = platforms.linux;
61
61
+
doInstallCheck = true;
62
62
+
installCheckPhase = ''
63
63
+
"$out/gui/scyther.py" "$src/gui/Protocols/Demo/ns3.spdl"
64
64
+
'';
81
65
};
82
82
-
}
66
66
+
in
67
67
+
buildEnv {
68
68
+
name = "scyther-${version}";
69
69
+
inherit meta;
70
70
+
paths = [ cli ] ++ lib.optional includeGUI gui;
71
71
+
pathsToLink = [ "/bin" ];
72
72
+
73
73
+
postBuild = ''
74
74
+
rm "$out/bin/scyther-linux"
75
75
+
'' + lib.optionalString includeProtocols ''
76
76
+
mkdir -p "$out/protocols"
77
77
+
cp -rv ${src}/protocols/* "$out/protocols"
78
78
+
'';
79
79
+
}
+1
-1
pkgs/top-level/all-packages.nix
···
17852
17852
17853
17853
plm = callPackage ../applications/science/programming/plm { };
17854
17854
17855
17855
-
scyther = callPackage_i686 ../applications/science/programming/scyther { };
17855
17855
+
scyther = callPackage ../applications/science/programming/scyther { };
17856
17856
17857
17857
### SCIENCE/LOGIC
17858
17858