Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# some dependencies need to be patched
# http://code.nsnam.org/bake/file/c502b48053dc/bakeconf.xml
{ stdenv, fetchFromGitHub, autoreconfHook, libtool, intltool, pkgconfig
, ns-3, gcc
, castxml ? null
# hidden dependency of waf
, ncurses
, python
, lib
, fetchurl
, withManual ? false
, withQuagga ? false
, withExamples ? false, openssl ? null, ccnd ? null, iperf2 ? null
# shall we generate bindings
, pythonSupport ? false
, ...
}:

let
dce-version = "1.10";
modules = [ "core" "network" "internet" "point-to-point" "fd-net-device"
"point-to-point-layout" "netanim" "tap-bridge" "mobility" "flow-monitor"]
++ lib.optionals withQuagga [ "internet-apps" ]
;

ns3forDce = ns-3.override( { inherit modules python; });
pythonEnv = python.withPackages(ps:
lib.optional withManual ps.sphinx
++ lib.optionals pythonSupport (with ps;[ pybindgen pygccxml ])
);

dce = stdenv.mkDerivation rec {
pname = "direct-code-execution";
version = dce-version;

outputs = [ "out" ] ++ lib.optional pythonSupport "py";

# with other modules
srcs = [
(fetchFromGitHub {
owner = "direct-code-execution";
repo = "ns-3-dce";
rev = "dce-${version}";
sha256 = "0f2g47mql8jjzn2q6lm0cbb5fv62sdqafdvx5g8s3lqri1sca14n";
name = "dce";
})
]
++ lib.optional withQuagga (fetchFromGitHub {
owner = "direct-code-execution";
repo = "ns-3-dce-quagga";
rev = "dce-${dce-version}";
sha256 = "1bbb1v33mv1p8isiggg9qg3a8hs0yq5s1dqz22lbdx55jrdxm7rb";
name = "dce-quagga";
})
;

postUnpack = lib.optionalString withQuagga ''
# mv won't work :'(
cp -R dce-quagga/ ${sourceRoot}/myscripts
'';

sourceRoot = "dce";

buildInputs = [ ns3forDce gcc pythonEnv ]
++ lib.optionals pythonSupport [ castxml ncurses ]
++ lib.optionals withExamples [ openssl ]
;

nativeBuildInputs = [ pkgconfig ];

doCheck = true;

patchPhase = ''
patchShebangs test.py
'';
configurePhase = ''
runHook preConfigure

${pythonEnv.interpreter} ./waf configure --prefix=$out \
--with-ns3=${ns3forDce} --with-python=${pythonEnv.interpreter} \
${lib.optionalString (!withExamples) "--disable-examples "} ${lib.optionalString (!doCheck) " --disable-tests" };

runHook postConfigure
'';

buildPhase=''
${pythonEnv.interpreter} ./waf build
'';

hardeningDisable = [ "all" ];

# shellHook= lib.optionalString withExamples ''
# export DCE_PATH=${iperf-dce}/bin
# '';

meta = {
homepage = https://www.nsnam.org/overview/projects/direct-code-execution;
license = lib.licenses.gpl3;
description = "Run real applications/network stacks in the simulator ns-3";
platforms = with lib.platforms; unix;
};
};
in
dce
41 changes: 41 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
description = "Run real programs in the discrete time simulator ns3";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem ["x86_64-linux"] (system: let
pkgs = import nixpkgs { inherit system; };

in {

packages.dce = pkgs.callPackage ./default.nix {};

defaultPackage = self.packages."${system}".dce;

});
}