From f27a434274687b6cb56b3418e2474f37f2be0e8d Mon Sep 17 00:00:00 2001 From: Viktor Sonesten Date: Mon, 5 May 2025 13:58:18 +0200 Subject: [PATCH] fmi-reference-fmus: init at 0.0.38 --- .../by-name/fm/fmi-reference-fmus/package.nix | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 pkgs/by-name/fm/fmi-reference-fmus/package.nix diff --git a/pkgs/by-name/fm/fmi-reference-fmus/package.nix b/pkgs/by-name/fm/fmi-reference-fmus/package.nix new file mode 100644 index 000000000000..e41e1223d8b9 --- /dev/null +++ b/pkgs/by-name/fm/fmi-reference-fmus/package.nix @@ -0,0 +1,47 @@ +{ + lib, + stdenv, + fetchFromGitHub, + cmake, + + # Build the FMUs following the latest FMI standard + FMIVersion ? 3, +}: + +# C.f. +assert lib.asserts.assertMsg ( + FMIVersion >= 1 && FMIVersion <= 3 +) "FMIVersion must be a valid FMI specification standard: 1, 2, or 3; not ${toString FMIVersion}"; + +# NB: this derivation does not package the fmusim executables, only +# the FMUs. +stdenv.mkDerivation (finalAttrs: { + pname = "reference-fmus"; + version = "0.0.38"; + src = fetchFromGitHub { + owner = "modelica"; + repo = finalAttrs.pname; + rev = "v${finalAttrs.version}"; + hash = "sha256-FeDKYcm9K670q1FGqy41Tp2Ag8p2JidH4z78zpHOngw="; + }; + + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ + "-DFMI_VERSION=${toString FMIVersion}" + (lib.cmakeBool "WITH_FMUSIM" false) + ]; + CFLAGS = lib.optionalString (FMIVersion == 3) "-Wno-stringop-truncation"; + + meta = { + # CMakeLists.txt explicitly states support for aarch64-darwin, but + # the build fails in a Nix environment. C.f. + # . + broken = with stdenv.hostPlatform; isAarch64 && isDarwin; + description = "Functional Mock-up Units for development, testing and debugging"; + homepage = "https://github.com/modelica/Reference-FMUs"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ tmplt ]; + platforms = lib.platforms.all; + }; +})