diff --git a/packaging/nix/ethercat.nix b/packaging/nix/ethercat.nix new file mode 100644 index 000000000..eacaf9151 --- /dev/null +++ b/packaging/nix/ethercat.nix @@ -0,0 +1,29 @@ +{ + autoconf, + automake, + cmake, + lib, + libtool, + pkg-config, + stdenv, + src, +}: +stdenv.mkDerivation { + pname = "ethercat"; + version = "villas"; + src = src; + separateDebugInfo = true; + nativeBuildInputs = [autoconf automake libtool pkg-config]; + preConfigure = '' + bash ./bootstrap + ''; + configureFlags = [ + "--enable-userlib=yes" + "--enable-kernel=no" + ]; + meta = with lib; { + description = "IgH EtherCAT Master for Linux"; + homepage = "https://etherlab.org/master"; + license = licenses.gpl2Only; + }; +} diff --git a/packaging/nix/flake.lock b/packaging/nix/flake.lock index 574abd6e2..91713f0fc 100644 --- a/packaging/nix/flake.lock +++ b/packaging/nix/flake.lock @@ -16,20 +16,36 @@ "type": "github" } }, + "ethercat": { + "flake": false, + "locked": { + "lastModified": 1689851599, + "narHash": "sha256-r829UW4ziY+QUxqjb2j2Bo+xJeUNWn6WiSRK3Gly2Zo=", + "owner": "etherlab.org", + "repo": "ethercat", + "rev": "c8a512ac077f2ab51bb072bfbef1a687f9f1c090", + "type": "gitlab" + }, + "original": { + "owner": "etherlab.org", + "ref": "stable-1.5", + "repo": "ethercat", + "type": "gitlab" + } + }, "fpga": { "flake": false, "locked": { - "lastModified": 1686871446, - "narHash": "sha256-pRFFr72NVge4UgwBvc8gYygnvOHghTSUGI+JtqpRlxo=", - "ref": "refs/heads/villas-node", - "rev": "ce8612379de62f50a52e172fe8eaee924d5d8822", - "revCount": 481, + "lastModified": 1690302379, + "narHash": "sha256-u2u4CUffhA9jxtuk4HokqlmyDQGNz4+LOEJ5Z9DhedU=", + "ref": "refs/heads/master", + "rev": "1cac3fafde6ef3098a145f9d5d936a2dc6b7d7c0", + "revCount": 532, "submodules": true, "type": "git", "url": "https://github.com/VILLASframework/fpga.git" }, "original": { - "ref": "refs/heads/villas-node", "submodules": true, "type": "git", "url": "https://github.com/VILLASframework/fpga.git" @@ -90,11 +106,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1687354544, - "narHash": "sha256-1Xu+QzyA10AiY21i27Zu9bqQAaxXBacNKbGUA9OZy7Y=", + "lastModified": 1692254348, + "narHash": "sha256-CyRMA7Rap1X65k4p/uoaLXhbnn+PZvwxNHSeLuiQ9ss=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "876181e3ae452cc6186486f6f7300a8a6de237cb", + "rev": "5353604b0affde24dcd75e59d0d22342b1758cfb", "type": "github" }, "original": { @@ -107,6 +123,7 @@ "root": { "inputs": { "common": "common", + "ethercat": "ethercat", "fpga": "fpga", "lib60870": "lib60870", "libdatachannel": "libdatachannel", diff --git a/packaging/nix/flake.nix b/packaging/nix/flake.nix index 1c7f4f0a1..2f87bb4c2 100644 --- a/packaging/nix/flake.nix +++ b/packaging/nix/flake.nix @@ -12,11 +12,15 @@ fpga = { type = "git"; url = "https://github.com/VILLASframework/fpga.git"; - ref = "refs/heads/villas-node"; submodules = true; flake = false; }; + ethercat = { + url = "gitlab:etherlab.org/ethercat/stable-1.5"; + flake = false; + }; + lib60870 = { url = "github:mz-automation/lib60870/v2.3.2"; flake = false; @@ -71,7 +75,8 @@ self.overlays.minimal ]; }) - .pkgsCross.${crossSystem}; + .pkgsCross + .${crossSystem}; # build villas and its dependencies for the specified `pkgs` packagesWith = pkgs: rec { @@ -91,6 +96,10 @@ withAllNodes = true; }; + ethercat = pkgs.callPackage ./ethercat.nix { + src = inputs.ethercat; + }; + lib60870 = pkgs.callPackage ./lib60870.nix { src = inputs.lib60870; }; @@ -131,7 +140,7 @@ pkgs = pkgsFor system; shellHook = ''[ -z "$PS1" ] || exec "$SHELL"''; hardeningDisable = ["all"]; - packages = with pkgs; [bashInteractive criterion bc jq]; + packages = with pkgs; [bashInteractive bc boxfort criterion jq libffi libgit2 pcre]; in rec { default = full; diff --git a/packaging/nix/villas.nix b/packaging/nix/villas.nix index 711793fab..a3de2c3e8 100644 --- a/packaging/nix/villas.nix +++ b/packaging/nix/villas.nix @@ -7,17 +7,23 @@ withAllFormats ? false, withAllHooks ? false, withAllNodes ? false, + # extras withExtraConfig ? withAllExtras, withExtraGraphviz ? withAllExtras, + # formats withFormatProtobuf ? withAllFormats, + # hooks withHookLua ? withAllHooks, + # nodes withNodeAmqp ? withAllNodes, withNodeComedi ? withAllNodes, withNodeFpga ? withAllNodes, + withNodeEthercat ? withAllNodes, withNodeIec60870 ? withAllNodes, withNodeIec61850 ? withAllNodes, withNodeInfiniband ? withAllNodes, withNodeKafka ? withAllNodes, + withNodeModbus ? withAllNodes, withNodeMqtt ? withAllNodes, withNodeNanomsg ? withAllNodes, withNodeRedis ? withAllNodes, @@ -42,12 +48,14 @@ comedilib, curl, czmq, + ethercat, gnugrep, jansson, lib60870, libconfig, libdatachannel, libiec61850, + libmodbus, libnl, libre, libsodium, @@ -73,7 +81,8 @@ stdenv.mkDerivation { pname = "villas"; outputs = ["out" "dev"]; separateDebugInfo = true; - cmakeFlags = [] + cmakeFlags = + [] ++ lib.optionals (!withGpl) ["-DWITHOUT_GPL=ON"] ++ lib.optionals withFormatProtobuf ["-DCMAKE_FIND_ROOT_PATH=${protobufcBuildBuild}/bin"]; postPatch = '' @@ -116,10 +125,12 @@ stdenv.mkDerivation { ++ lib.optionals withHookLua [lua] ++ lib.optionals withNodeAmqp [rabbitmq-c] ++ lib.optionals withNodeComedi [comedilib] + ++ lib.optionals withNodeEthercat [ethercat] ++ lib.optionals withNodeIec60870 [lib60870] ++ lib.optionals withNodeIec61850 [libiec61850] ++ lib.optionals withNodeInfiniband [rdma-core] ++ lib.optionals withNodeKafka [rdkafka] + ++ lib.optionals withNodeModbus [libmodbus] ++ lib.optionals withNodeMqtt [mosquitto] ++ lib.optionals withNodeNanomsg [nanomsg] ++ lib.optionals withNodeRedis [redis-plus-plus]