nixpkgs/pkgs/applications/misc/qelectrotech/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

80 lines
2.0 KiB
Nix

{ lib
, stdenv
, mkDerivation
, fetchzip
, installShellFiles
, pkg-config
, qmake
, qtbase
, kcoreaddons
, kwidgetsaddons
}:
mkDerivation rec {
pname = "qelectrotech";
version = "0.8.0";
src = fetchzip {
url = "https://git.tuxfamily.org/qet/qet.git/snapshot/qet-${version}.tar.gz";
sha256 = "sha256-op2vnMPF9bNnHGphWFB/HEeoThE6tX+9UvX8LWVwkzI=";
};
postPatch = ''
substituteInPlace qelectrotech.pro \
--replace 'GIT_COMMIT_SHA="\\\"$(shell git -C \""$$_PRO_FILE_PWD_"\" rev-parse --verify HEAD)\\\""' \
'GIT_COMMIT_SHA="\\\"${version}\\\""' \
--replace "COMPIL_PREFIX = '/usr/local/'" \
"COMPIL_PREFIX = '$out/'" \
--replace "INSTALL_PREFIX = '/usr/local/'" \
"INSTALL_PREFIX = '$out/'"
'';
nativeBuildInputs = [
installShellFiles
pkg-config
qmake
];
buildInputs = [
kcoreaddons
kwidgetsaddons
qtbase
];
qmakeFlags = [
"INSTALLROOT=$(out)"
];
installPhase = ''
runHook preInstall
install -Dm555 qelectrotech $out/bin/qelectrotech
install -Dm444 -t $out/share/applications misc/qelectrotech.desktop
install -Dm444 -t $out/share/applications misc/x-qet-titleblock.desktop
install -Dm444 -t $out/share/applications misc/x-qet-element.desktop
install -Dm444 -t $out/share/applications misc/x-qet-project.desktop
mkdir -p $out/share/qelectrotech
cp -r elements $out/share/qelectrotech
cp -r titleblocks $out/share/qelectrotech
cp -r lang $out/share/qelectrotech
cp -r examples $out/share/qelectrotech
mkdir -p $out/share/icons/hicolor
cp -r ico $out/share/icons/hicolor
runHook postInstall
'';
meta = with lib; {
description = "Free software to create electric diagrams";
mainProgram = "qelectrotech";
homepage = "https://qelectrotech.org/";
license = licenses.gpl2;
maintainers = with maintainers; [ yvesf ];
platforms = qtbase.meta.platforms;
broken = stdenv.hostPlatform.isDarwin;
};
}