about summary refs log tree commit diff
path: root/pkgs/applications/virtualization/vpcs/default.nix
blob: 15f769ef96981e00fa7c2367abc00b04cb826f02 (plain) (blame)
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
{ lib
, stdenv
, fetchFromGitHub
, testers
, vpcs
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "vpcs";
  version = "0.8.3";

  src = fetchFromGitHub {
    owner = "GNS3";
    repo = "vpcs";
    rev = "v${finalAttrs.version}";
    hash = "sha256-OKi4sC4fmKtkJkkpHZ6OfeIDaBafVrJXGXh1R6gLPFY=";
  };

  sourceRoot = "${finalAttrs.src.name}/src";

  buildPhase = ''
    runHook preBuild

    MKOPT="CC=${stdenv.cc.targetPrefix}cc" ./mk.sh ${stdenv.buildPlatform.linuxArch}

    runHook postBuild
  '';

  installPhase = ''
    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 = "Simple virtual PC simulator";
    longDescription = ''
      The VPCS (Virtual PC Simulator) can simulate up to 9 PCs. You can
      ping/traceroute them, or ping/traceroute the other hosts/routers from the
      VPCS when you study the Cisco routers in the dynamips.
    '';
    inherit (finalAttrs.src.meta) homepage;
    license = licenses.bsd2;
    platforms = platforms.linux ++ platforms.darwin;
    mainProgram = "vpcs";
    maintainers = with maintainers; [ anthonyroussel ];
  };
})