nixpkgs/pkgs/tools/misc/archi/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

85 lines
2.4 KiB
Nix

{ lib, stdenv
, fetchurl
, autoPatchelfHook
, makeWrapper
, jdk
, libsecret
, webkitgtk
, wrapGAppsHook3
, _7zz
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "Archi";
version = "5.3.0";
src = {
"x86_64-linux" = fetchurl {
url = "https://www.archimatetool.com/downloads/archi/${version}/Archi-Linux64-${version}.tgz";
hash = "sha256-ngO3YFCChsnefxdxtR00Dy736K2GYnTEYI4vKWLnPsw=";
};
"x86_64-darwin" = fetchurl {
url = "https://www.archimatetool.com/downloads/archi/${version}/Archi-Mac-${version}.dmg";
hash = "sha256-dL1c7IrbDMY/WbijQh1dCmCrRQQhj4fjGN+6m19OjO0=";
};
"aarch64-darwin" = fetchurl {
url = "https://www.archimatetool.com/downloads/archi/${version}/Archi-Mac-Silicon-${version}.dmg";
hash = "sha256-iczIUm1LCAjYKOyHXbFCgb+zoUxxATSOVkB8Ldk7pxQ=";
};
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
buildInputs = [
libsecret
];
nativeBuildInputs = [
makeWrapper
wrapGAppsHook3
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
_7zz
] ++ lib.optionals stdenv.hostPlatform.isLinux [
autoPatchelfHook
];
sourceRoot = if stdenv.hostPlatform.isDarwin then "." else null;
installPhase =
if stdenv.hostPlatform.system == "x86_64-linux" then
''
mkdir -p $out/bin $out/libexec
for f in configuration features p2 plugins Archi.ini; do
cp -r $f $out/libexec
done
install -D -m755 Archi $out/libexec/Archi
makeWrapper $out/libexec/Archi $out/bin/Archi \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ webkitgtk ])} \
--set WEBKIT_DISABLE_DMABUF_RENDERER 1 \
--prefix PATH : ${jdk}/bin
''
else
''
mkdir -p "$out/Applications"
mv Archi.app "$out/Applications/"
'';
passthru.updateScript = ./update.sh;
passthru.tests = { inherit (nixosTests) archi; };
meta = with lib; {
description = "ArchiMate modelling toolkit";
longDescription = ''
Archi is an open source modelling toolkit to create ArchiMate
models and sketches.
'';
homepage = "https://www.archimatetool.com/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ earldouglas paumr ];
mainProgram = "Archi";
};
}