nixpkgs/pkgs/applications/graphics/antimony/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

72 lines
2.0 KiB
Nix

{ lib, stdenv, fetchFromGitHub, libpng, python3
, libGLU, libGL, qtbase, wrapQtAppsHook, ncurses
, cmake, flex, lemon
, makeDesktopItem, copyDesktopItems
}:
let
gitRev = "8b805c674adad536f9dd552b4be75fadcb3c7db6";
gitBranch = "develop";
gitTag = "0.9.3";
in
stdenv.mkDerivation {
pname = "antimony";
version = "2022-11-23";
src = fetchFromGitHub {
owner = "mkeeter";
repo = "antimony";
rev = gitRev;
sha256 = "NmOuBewfHqtAim2cNP62LXgRjVWuVUGweV46sY1qjGk=";
};
patches = [ ./paths-fix.patch ];
postPatch = ''
sed -i "s,/usr/local,$out,g" \
app/CMakeLists.txt app/app/app.cpp app/app/main.cpp
sed -i "s,python3,${python3.executable}," CMakeLists.txt
'';
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
install -Dm644 $src/deploy/icon.svg $out/share/icons/hicolor/scalable/apps/antimony.svg
install -Dm644 ${./mimetype.xml} $out/share/mime/packages/antimony.xml
'';
buildInputs = [
libpng python3 python3.pkgs.boost
libGLU libGL qtbase ncurses
];
nativeBuildInputs = [ cmake flex lemon wrapQtAppsHook copyDesktopItems ];
desktopItems = [
(makeDesktopItem {
name = "antimony";
desktopName = "Antimony";
comment="Tree-based Modeler";
genericName = "CAD Application";
exec = "antimony %f";
icon = "antimony";
categories = [ "Graphics" "Science" "Engineering" ];
mimeTypes = [ "application/x-extension-sb" "application/x-antimony" ];
startupWMClass = "antimony";
})
];
cmakeFlags= [
"-DGITREV=${gitRev}"
"-DGITTAG=${gitTag}"
"-DGITBRANCH=${gitBranch}"
];
meta = with lib; {
description = "Computer-aided design (CAD) tool from a parallel universe";
mainProgram = "antimony";
homepage = "https://github.com/mkeeter/antimony";
license = licenses.mit;
maintainers = with maintainers; [ rnhmjoj ];
platforms = platforms.linux;
};
}