mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-02 11:03:57 +00:00
e0464e4788
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" ```
77 lines
2.3 KiB
Nix
77 lines
2.3 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, qt6
|
|
, makeDesktopItem
|
|
, copyDesktopItems
|
|
}:
|
|
stdenv.mkDerivation (self: {
|
|
pname = "cloudlogoffline";
|
|
version = "1.1.5";
|
|
rev = self.version;
|
|
hash = "sha256-CF56yk7hsM4M43le+CLy93oLyZ9kaqaRTFWtjJuF6Vo=";
|
|
|
|
src = fetchFromGitHub {
|
|
inherit (self) rev hash;
|
|
owner = "myzinsky";
|
|
repo = "cloudLogOffline";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
qt6.qmake
|
|
qt6.wrapQtAppsHook
|
|
]
|
|
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
|
copyDesktopItems
|
|
];
|
|
|
|
buildInputs = [
|
|
qt6.qtbase
|
|
qt6.qtlocation
|
|
qt6.qtpositioning
|
|
qt6.qtsvg
|
|
];
|
|
|
|
postPatch = let
|
|
targetDir = if stdenv.hostPlatform.isDarwin then "Applications" else "bin";
|
|
in ''
|
|
substituteInPlace CloudLogOffline.pro \
|
|
--replace 'target.path = /opt/$''${TARGET}/bin' "target.path = $out/${targetDir}"
|
|
'';
|
|
|
|
postInstall = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
|
install -d $out/share/pixmaps
|
|
install -m644 images/logo_circle.svg $out/share/pixmaps/cloudlogoffline.svg
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
# FIXME: For some reason, the Info.plist isn't copied correctly to
|
|
# the application bundle when building normally, instead creating an
|
|
# empty file. This doesn't happen when building in a dev shell with
|
|
# genericBuild.
|
|
# So, just copy the file manually.
|
|
plistPath="$out/Applications/CloudLogOffline.app/Contents/Info.plist"
|
|
[[ -s "$plistPath" ]] && { echo "expected Info.plist to be empty; workaround no longer needed?"; exit 1; }
|
|
install -m644 macos/Info.plist $out/Applications/CloudLogOffline.app/Contents/Info.plist
|
|
'';
|
|
|
|
desktopItems = lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
|
(makeDesktopItem {
|
|
name = "cloudlogoffline";
|
|
desktopName = "CloudLogOffline";
|
|
exec = "CloudLogOffline";
|
|
icon = "cloudlogoffline";
|
|
comment = self.meta.description;
|
|
genericName = "Ham radio contact logbook";
|
|
categories = [ "Network" "Utility" "HamRadio" ];
|
|
})
|
|
];
|
|
|
|
meta = {
|
|
description = "Offline frontend for Cloudlog";
|
|
homepage = "https://github.com/myzinsky/cloudLogOffline";
|
|
license = [ lib.licenses.lgpl3 ];
|
|
mainProgram = "CloudLogOffline";
|
|
maintainers = [ lib.maintainers.dblsaiko ];
|
|
platforms = lib.platforms.unix;
|
|
};
|
|
})
|