nixpkgs/pkgs/by-name/qt/qtalarm/package.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

82 lines
1.9 KiB
Nix

{
stdenv,
lib,
fetchFromGitHub,
libsForQt5,
qt5,
makeDesktopItem,
nix-update-script,
copyDesktopItems,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "qtalarm";
version = "2.5.1";
src = fetchFromGitHub {
owner = "CountMurphy";
repo = "QTalarm";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-87w5YFQ9olLnCfPF04jOnIMn1NtE2M2n5WZX4e69UGU=";
};
buildInputs = [
libsForQt5.qtbase
libsForQt5.qtmultimedia
];
installPhase =
''
runHook preInstall
''
+ (
if stdenv.hostPlatform.isDarwin then
''
mkdir -p $out/Applications
mv qtalarm.app $out/Applications
''
else
''
install -Dm755 qtalarm -t $out/bin
install -Dm644 Icons/1349069370_Alarm_Clock.png $out/share/icons/hicolor/48x48/apps/qtalarm.png
install -Dm644 Icons/1349069370_Alarm_Clock24.png $out/share/icons/hicolor/24x24/apps/qtalarm.png
install -Dm644 Icons/1349069370_Alarm_Clock16.png $out/share/icons/hicolor/16x16/apps/qtalarm.png
''
)
+ ''
runHook postInstall
'';
nativeBuildInputs = [
qt5.wrapQtAppsHook
qt5.qmake
copyDesktopItems
];
passthru.updateScript = nix-update-script { };
desktopItems = [
(makeDesktopItem {
name = "QTalarm";
exec = "qtalarm";
icon = "qtalarm";
desktopName = "QTalarm";
genericName = "Nifty alarm clock";
categories = [
"Application"
"Utility"
];
terminal = false;
})
];
meta = {
description = "Nifty alarm clock written in QT";
changelog = "https://github.com/CountMurphy/QTalarm/releases/tag/${finalAttrs.version}";
homepage = "https://github.com/CountMurphy/QTalarm";
license = lib.licenses.gpl3Only;
mainProgram = "qtalarm";
maintainers = with lib.maintainers; [ bot-wxt1221 ];
platforms = lib.platforms.unix;
};
})