Skip to content

Commit 5257232

Browse files
committedSep 22, 2017
gns3: "Improve" the packaging
This is "a bit" hacky tho... The improvement is that it now covers the stable as well as the preview releases and doesn't require Python 3.4 anymore.
1 parent 1acf671 commit 5257232

File tree

4 files changed

+100
-24
lines changed

4 files changed

+100
-24
lines changed
 

Diff for: ‎pkgs/applications/networking/gns3/default.nix

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{ callPackage, stdenv }:
2+
3+
let
4+
stableVersion = "2.0.3";
5+
previewVersion = "2.1.0rc1";
6+
addVersion = args:
7+
let version = if args.stable then stableVersion else previewVersion;
8+
branch = if args.stable then "stable" else "preview";
9+
in args // { inherit version branch; };
10+
mkGui = args: callPackage (import ./gui.nix (addVersion args)) { };
11+
mkServer = args: callPackage (import ./server.nix (addVersion args)) { };
12+
in {
13+
guiStable = mkGui {
14+
stable = true;
15+
sha256Hash = "10qp6430md8d0h2wamgfaq7pai59mqmcw6sw3i1gvb20m0avvsvb";
16+
};
17+
guiPreview = mkGui {
18+
stable = false;
19+
sha256Hash = "0rmvanzc0fjw9giqwnf98yc49cxaz637w8b865dv08lcf1fg9j8l";
20+
};
21+
22+
serverStable = mkServer {
23+
stable = true;
24+
sha256Hash = "1c7mzj1r2zh90a7vs3s17jakfp9s43b8nnj29rpamqxvl3qhbdy7";
25+
};
26+
serverPreview = mkServer {
27+
stable = false;
28+
sha256Hash = "181689fpjxq4hy2lyxk4zciqhgnhj5srvb4xsxdlbf68n89fj2zf";
29+
};
30+
}

Diff for: ‎pkgs/applications/networking/gns3/gui.nix

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
{ stdenv, python34Packages, fetchFromGitHub }:
1+
{ stable, branch, version, sha256Hash }:
22

3-
# TODO: Python 3.6 was failing
4-
python34Packages.buildPythonPackage rec {
3+
{ stdenv, python3Packages, fetchFromGitHub }:
4+
5+
let
6+
pythonPackages = python3Packages;
7+
8+
in pythonPackages.buildPythonPackage rec {
59
name = "${pname}-${version}";
610
pname = "gns3-gui";
7-
version = "2.0.3";
811

912
src = fetchFromGitHub {
1013
owner = "GNS3";
1114
repo = pname;
1215
rev = "v${version}";
13-
sha256 = "10qp6430md8d0h2wamgfaq7pai59mqmcw6sw3i1gvb20m0avvsvb";
16+
sha256 = sha256Hash;
1417
};
1518

16-
propagatedBuildInputs = with python34Packages; [
19+
propagatedBuildInputs = with pythonPackages; [
1720
raven psutil jsonschema # tox for check
1821
# Runtime dependencies
1922
sip pyqt5
@@ -22,11 +25,13 @@ python34Packages.buildPythonPackage rec {
2225
doCheck = false; # Failing
2326

2427
meta = with stdenv.lib; {
25-
description = "Graphical Network Simulator";
26-
#longDescription = ''
27-
# ...
28-
#'';
29-
homepage = "https://www.gns3.com/";
28+
description = "Graphical Network Simulator 3 GUI (${branch} release)";
29+
longDescription = ''
30+
Graphical user interface for controlling the GNS3 network simulator. This
31+
requires access to a local or remote GNS3 server (it's recommended to
32+
download the official GNS3 VM).
33+
'';
34+
homepage = https://www.gns3.com/;
3035
license = licenses.gpl3Plus;
3136
platforms = platforms.linux;
3237
maintainers = with maintainers; [ primeos ];

Diff for: ‎pkgs/applications/networking/gns3/server.nix

+51-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,63 @@
1-
{ stdenv, python3Packages, fetchFromGitHub }:
1+
{ stable, branch, version, sha256Hash }:
22

3-
python3Packages.buildPythonPackage rec {
3+
{ stdenv, python3Packages, fetchFromGitHub, fetchurl }:
4+
5+
let
6+
pythonPackages = python3Packages;
7+
yarl = if (!stable) then pythonPackages.yarl
8+
else (stdenv.lib.overrideDerivation pythonPackages.yarl (oldAttrs:
9+
rec {
10+
pname = "yarl";
11+
version = "0.9.8";
12+
name = "${pname}-${version}";
13+
src = pythonPackages.fetchPypi {
14+
inherit pname version;
15+
sha256 = "1v2dsmr7bqp0yx51pwhbxyvzza8m2f88prsnbd926mi6ah38p0d7";
16+
};
17+
}));
18+
aiohttp = if (!stable) then pythonPackages.aiohttp
19+
else (stdenv.lib.overrideDerivation pythonPackages.aiohttp (oldAttrs:
20+
rec {
21+
pname = "aiohttp";
22+
version = "1.3.5";
23+
name = "${pname}-${version}";
24+
src = pythonPackages.fetchPypi {
25+
inherit pname version;
26+
sha256 = "0hpqdiaifgyfqmxkyzwypwvrnvz5rqzgzylzhihfidc5ldfs856d";
27+
};
28+
propagatedBuildInputs = [ yarl ]
29+
++ (with pythonPackages; [ async-timeout chardet multidict ]);
30+
}));
31+
aiohttp-cors = if (!stable) then pythonPackages.aiohttp-cors
32+
else (stdenv.lib.overrideDerivation pythonPackages.aiohttp-cors (oldAttrs:
33+
rec {
34+
pname = "aiohttp-cors";
35+
version = "0.5.1";
36+
name = "${pname}-${version}";
37+
src = pythonPackages.fetchPypi {
38+
inherit pname version;
39+
sha256 = "0szma27ri25fq4nwwvs36myddggw3jz4pyzmq63yz4xpw0jjdxck";
40+
};
41+
propagatedBuildInputs = [ aiohttp ];
42+
}));
43+
in pythonPackages.buildPythonPackage rec {
444
name = "${pname}-${version}";
545
pname = "gns3-server";
6-
version = "2.1.0rc1";
746

847
src = fetchFromGitHub {
948
owner = "GNS3";
1049
repo = pname;
1150
rev = "v${version}";
12-
sha256 = "181689fpjxq4hy2lyxk4zciqhgnhj5srvb4xsxdlbf68n89fj2zf";
51+
sha256 = sha256Hash;
1352
};
1453

15-
propagatedBuildInputs = with python3Packages; [
16-
aiohttp jinja2 psutil zipstream aiohttp-cors raven jsonschema yarl typing
17-
prompt_toolkit
18-
];
54+
propagatedBuildInputs = [ yarl aiohttp aiohttp-cors ]
55+
++ (with pythonPackages; [
56+
jinja2 psutil zipstream raven jsonschema typing
57+
prompt_toolkit
58+
]);
1959

20-
postPatch = ''
60+
postPatch = stdenv.lib.optionalString (!stable) ''
2161
sed -i 's/yarl>=0.11,<0.12/yarl/g' requirements.txt
2262
'';
2363

@@ -28,13 +68,13 @@ python3Packages.buildPythonPackage rec {
2868
rm $out/bin/gns3loopback # For windows only
2969
'';
3070
meta = with stdenv.lib; {
31-
description = "Graphical Network Simulator 3 server";
71+
description = "Graphical Network Simulator 3 server (${branch} release)";
3272
longDescription = ''
3373
The GNS3 server manages emulators such as Dynamips, VirtualBox or
3474
Qemu/KVM. Clients like the GNS3 GUI control the server using a HTTP REST
3575
API.
3676
'';
37-
homepage = "https://www.gns3.com/";
77+
homepage = https://www.gns3.com/;
3878
license = licenses.gpl3Plus;
3979
platforms = platforms.linux;
4080
maintainers = with maintainers; [ primeos ];

Diff for: ‎pkgs/top-level/all-packages.nix

+3-2
Original file line numberDiff line numberDiff line change
@@ -8256,8 +8256,9 @@ with pkgs;
82568256
# A GMP fork
82578257
mpir = callPackage ../development/libraries/mpir {};
82588258

8259-
gns3-gui = callPackage ../applications/networking/gns3/gui.nix { };
8260-
gns3-server = callPackage ../applications/networking/gns3/server.nix { };
8259+
gns3Packages = callPackage ../applications/networking/gns3 { };
8260+
gns3-gui = gns3Packages.guiStable;
8261+
gns3-server = gns3Packages.serverStable;
82618262

82628263
gobjectIntrospection = callPackage ../development/libraries/gobject-introspection {
82638264
nixStoreDir = config.nix.storeDir or builtins.storeDir;

0 commit comments

Comments
 (0)
Please sign in to comment.