diff --git a/configuration.nix b/configuration.nix index 03120b3..2046915 100644 --- a/configuration.nix +++ b/configuration.nix @@ -439,6 +439,69 @@ in ''; }) + (stdenv.mkDerivation { + pname = "erlu-idef0-editor"; + version = "1.0.1"; + + src = builtins.fetchGit { + url = "http://45.87.246.92/forgejo/gregorbednov/erlu.git"; + ref = "master"; + rev = "58198c6ecd8572f1c7db42b90c8189954c9a32fc"; + }; + nativeBuildInputs = with pkgs; [ + cmake + pkg-config + qt6.wrapQtAppsHook + qt6.qttools + ]; + + buildInputs = with pkgs; [ + qt6.qtbase + qt6.qtsvg + ]; + + configurePhase = '' + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=$out \ + -DBUILD_COLORS_PLUGIN=ON + ''; + + buildPhase = '' + cmake --build build + find . -path "*/translations/*.ts" -print0 | while IFS= read -r -d "" f; do + out_path=$(printf '%s\n' "$f" | sed 's/\.ts$/.qm/') + lrelease "$f" -qm "$out_path" + done + ''; + + installPhase = '' + runHook preInstall + cmake --install build --prefix $out + # app translations + if [ -d translations ]; then + mkdir -p $out/share/idef0/translations + find translations -maxdepth 1 -type f -name '*.qm' -print0 | xargs -0 -r cp -t $out/share/idef0/translations + fi + # plugin translations + find src/plugins -path "*/translations/*.qm" -print0 | while IFS= read -r -d "" f; do + rel="''${f#src/plugins/}" # e.g., color/translations/colors_en.qm + plugdir="''${rel%%/translations/*}" # e.g., color + dest="$out/plugins/$plugdir/translations" + mkdir -p "$dest" + cp "$f" "$dest/" + done + runHook postInstall + ''; + + qtWrapperArgs = [ "--set" "QT_LOGGING_RULES" "qt.qpa.wayland.textinput=false" ]; + meta = with lib; { + description = "IDEF0 diagram editor built with Qt 6 Widgets"; + license = licenses.lgpl3Plus; + mainProgram = "erlu_idef0_editor"; + platforms = platforms.linux; + }; + }) + (pkgs.writeShellScriptBin "gcc" ''${pkgs.clang}/bin/clang "$@"'') (pkgs.writeShellScriptBin "g++" ''${pkgs.clang}/bin/clang++ "$@"'')