about summary refs log tree commit diff
path: root/pkgs/applications/virtualization/vpcs
diff options
context:
space:
mode:
authorAnthony Roussel <anthony@roussel.dev>2023-09-22 17:21:51 +0200
committerGitHub <noreply@github.com>2023-09-22 17:21:51 +0200
commit1cf41e128b991d257b19f02342723e8bf219e8dd (patch)
tree0773df0d592d3e67d7a78913fccb84db1e483405 /pkgs/applications/virtualization/vpcs
parent5d5d09d4ad8df3304766cb741b996d37437b7bb6 (diff)
vpcs: 0.8.2 -> 0.8.3, enable darwin support (#256458)
* vpcs: 0.8.2 -> 0.8.3

https://github.com/GNS3/vpcs/compare/v0.8.2...v0.8.3

* vpcs: enable darwin support

* vpcs: add anthonyroussel to maintainers

* vpcs: add passthru.tests.version

* vpcs: add meta.mainProgram

* vpcs: drop gcc

* vpcs: refactor

---------

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
Diffstat (limited to 'pkgs/applications/virtualization/vpcs')
-rw-r--r--pkgs/applications/virtualization/vpcs/default.nix54
1 files changed, 38 insertions, 16 deletions
diff --git a/pkgs/applications/virtualization/vpcs/default.nix b/pkgs/applications/virtualization/vpcs/default.nix
index 7c2424ef0f44a..c1bce1f9bc7f0 100644
--- a/pkgs/applications/virtualization/vpcs/default.nix
+++ b/pkgs/applications/virtualization/vpcs/default.nix
@@ -1,28 +1,49 @@
-{ lib, stdenv, fetchFromGitHub }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, testers
+, vpcs
+}:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "vpcs";
-  version = "0.8.2";
+  version = "0.8.3";
 
   src = fetchFromGitHub {
     owner = "GNS3";
-    repo = pname;
-    rev = "v${version}";
-    sha256 = "sha256-joEXRMtNZMQumkYDX1gdpGAV+XdNKiAMj3dh1GZxeqc=";
+    repo = "vpcs";
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-OKi4sC4fmKtkJkkpHZ6OfeIDaBafVrJXGXh1R6gLPFY=";
   };
 
-  buildPhase = ''(
-    cd src
-    ./mk.sh ${stdenv.buildPlatform.linuxArch}
-  )'';
+  sourceRoot = "${finalAttrs.src.name}/src";
+
+  buildPhase = ''
+    runHook preBuild
+
+    MKOPT="CC=${stdenv.cc.targetPrefix}cc" ./mk.sh ${stdenv.buildPlatform.linuxArch}
+
+    runHook postBuild
+  '';
 
   installPhase = ''
-    install -D -m555 src/vpcs $out/bin/vpcs;
-    install -D -m444 man/vpcs.1 $out/share/man/man1/vpcs.1;
+    runHook preInstall
+
+    install -D -m555 vpcs $out/bin/vpcs
+    install -D -m444 ../man/vpcs.1 $out/share/man/man1/vpcs.1
+
+    runHook postInstall
   '';
 
   enableParallelBuilding = true;
 
+  passthru = {
+    tests.version = testers.testVersion {
+      package = vpcs;
+      command = "vpcs -v";
+    };
+  };
+
   meta = with lib; {
     description = "A simple virtual PC simulator";
     longDescription = ''
@@ -30,9 +51,10 @@ stdenv.mkDerivation rec {
       ping/traceroute them, or ping/traceroute the other hosts/routers from the
       VPCS when you study the Cisco routers in the dynamips.
     '';
-    inherit (src.meta) homepage;
+    inherit (finalAttrs.src.meta) homepage;
     license = licenses.bsd2;
-    platforms = platforms.linux;
-    maintainers = with maintainers; [ ];
+    platforms = platforms.linux ++ platforms.darwin;
+    mainProgram = "vpcs";
+    maintainers = with maintainers; [ anthonyroussel ];
   };
-}
+})