diff --git a/flake.nix b/flake.nix index 4aa5c24..9515865 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,15 @@ pkgs.openemsh pkgs.cmake-utils-full ]; + packages = [ + pkgs.openems + pkgs.appcsxcad + (pkgs.octave.withPackages (p: [ + pkgs.octave-openems + pkgs.octave-csxcad + pkgs.octave-openems-hll + ])) + ]; }; doc = pkgs.mkShell { @@ -57,6 +66,196 @@ openemsh = prev.callPackage ./default.nix { stdenv = prev.llvmPackages_13.stdenv; }; + + csxcad = (prev.csxcad.overrideAttrs (new: old: { + version = "0.6.3"; + src = prev.fetchFromGitHub { + owner = "thliebig"; + repo = "CSXCAD"; + rev = "v${new.version}"; + hash = "sha256-SSV5ulx3rCJg99I/oOQbqe+gOSs+BfcCo6UkWHVhnSs="; + }; + prePatch = '' + substituteInPlace CMakeLists.txt --replace-fail 'INSTALL(DIRECTORY matlab DESTINATION share/CSXCAD)' "" + ''; + outputs = [ "out" "dev" ]; + })).override { + stdenv = prev.fastStdenv; + }; + + qcsxcad = (prev.qcsxcad.overrideAttrs (new: old: { + nativeBuildInputs = old.nativeBuildInputs ++ [ + prev.libsForQt5.wrapQtAppsHook + ]; + })).override { + mkDerivation = prev.fastStdenv.mkDerivation; + inherit (final) csxcad; + }; + + appcsxcad = (prev.appcsxcad.overrideAttrs (new: old: { + nativeBuildInputs = old.nativeBuildInputs ++ [ + prev.libsForQt5.wrapQtAppsHook + ]; + })).override { + mkDerivation = prev.fastStdenv.mkDerivation; + inherit (final) csxcad qcsxcad; + }; + + openems = (prev.openems.overrideAttrs (new: old: { + version = "0.0.36"; + src = prev.fetchFromGitHub { + owner = "thliebig"; + repo = "openEMS"; + rev = "v${new.version}"; + hash = "sha256-wdH+Zw7G2ZigzBMX8p3GKdFVx/AhbTNL+P3w+YjI/dc="; + }; + postFixup = ""; # Avoid oct file building / setup.m patching. + prePatch = '' + substituteInPlace CMakeLists.txt --replace-fail 'INSTALL( DIRECTORY matlab DESTINATION share/openEMS )' "" + ''; + outputs = [ "out" "dev" ]; + })).override { + stdenv = prev.fastStdenv; + inherit (final) csxcad qcsxcad; + }; + + octave-csxcad = prev.octavePackages.buildOctavePackage rec { + inherit (final.csxcad) pname version meta src; + patchPhase = + let + description = '' + Name: csxcad + Version: ${version} + Date: 2016-07-06 + Author: Thorsten Liebig + Maintainer: Thomas Lepoix + Title: C++ library to describe geometrical objects + Description: Signal processing tools, including filtering, windowing and display functions. + Categories: Electromagnetics + License: GPLv3 + Url: https://github.com/thliebig/CSXCAD + ''; + in '' + sed -i matlab/CSXGeomPlot.m \ + -e '30,36d' + substituteInPlace matlab/CSXGeomPlot.m --replace-fail \ + "command = [AppCSXCAD_bin" \ + "command = ['env AppCSXCAD'" + + echo "TMPDIR: $TMPDIR" + + mkdir -p $TMPDIR/out + mv ./NEWS $TMPDIR/out/ + mv ./COPYING $TMPDIR/out/ + mv ./matlab $TMPDIR/out/inst + cat > $TMPDIR/out/DESCRIPTION < + Title: Electromagnetic field solver + Description: Signal processing tools, including filtering, windowing and display functions. + Categories: Electromagnetics + License: GPLv3 + Url: https://github.com/thliebig/openEMS + ''; + in '' + sed -i matlab/private/invoke_openEMS.m \ + -e '29,35d' + substituteInPlace matlab/private/invoke_openEMS.m --replace-fail \ + "command = [openEMS_bin" \ + "command = ['env openEMS'" + sed -i matlab/CalcNF2FF.m \ + -e '101,107d' \ + -e '124,126d' + substituteInPlace matlab/CalcNF2FF.m --replace-fail \ + "system(['export LD_LIBRARY_PATH=; ' nf2ff_bin" \ + "system(['env nf2ff'" + + mkdir -p $TMPDIR/out/ + mv ./NEWS $TMPDIR/out/ + mv ./COPYING $TMPDIR/out/ + rm ./matlab/setup.m + mv ./matlab $TMPDIR/out/inst + cat > $TMPDIR/out/DESCRIPTION <