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