nixpkgs/pkgs/applications/graphics/drawpile/default.nix
Adam Joseph 42815b4a0c treewide: systemdSupport: use lib.meta.availableOn
Many packages have some kind of flag indicating whether or not to build with
systemd support.  Most of these default to `stdenv.isLinux`, but systemd does
not build on (and is marked `broken` for) `isStatic`.  Only a few packages have
the needed `&& !isStatic` in the default value for their parameter.

This commit moves the logic for the default value of these flags into
`systemd.meta.{platforms,badPlatforms}` and evaluates those conditions using
`lib.meta.availableOn`.

This provides three benefits:

1. The default values are set correctly (i.e. including `&& isStatic`)

2. The default values are set consistently

3. The way is paved for any future non-Linux systemd platforms (FreeBSD is
   reported to have experimental systemd support)
2023-01-22 00:27:19 -08:00

109 lines
2.2 KiB
Nix

{ stdenv
, lib
, mkDerivation
, fetchFromGitHub
, extra-cmake-modules
# common deps
, karchive
# client deps
, qtbase
, qtkeychain
, qtmultimedia
, qtsvg
, qttools
, libsecret
# optional client deps
, giflib
, kdnssd
, libvpx
, miniupnpc
, qtx11extras # kis
# optional server deps
, libmicrohttpd
, libsodium
, withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd
, systemd ? null
# options
, buildClient ? true
, buildServer ? true
, buildServerGui ? true # if false builds a headless server
, buildExtraTools ? false
, enableKisTablet ? false # enable improved graphics tablet support
}:
with lib;
let
clientDeps = [
qtbase
qtkeychain
qtmultimedia
qtsvg
qttools
libsecret
# optional:
giflib # gif animation export support
kdnssd # local server discovery with Zeroconf
libvpx # WebM video export
miniupnpc # automatic port forwarding
];
serverDeps = [
# optional:
libmicrohttpd # HTTP admin api
libsodium # ext-auth support
] ++ optional withSystemd systemd;
kisDeps = [
qtx11extras
];
boolToFlag = bool:
if bool then "ON" else "OFF";
in mkDerivation rec {
pname = "drawpile";
version = "2.1.20";
src = fetchFromGitHub {
owner = "drawpile";
repo = "drawpile";
rev = version;
sha256 = "sha256-HjGsaa2BYRNxaQP9e8Z7BkVlIKByC/ta92boGbYHRWQ=";
};
nativeBuildInputs = [ extra-cmake-modules ];
buildInputs = [
karchive
]
++ optionals buildClient clientDeps
++ optionals buildServer serverDeps
++ optionals enableKisTablet kisDeps;
cmakeFlags = [
"-Wno-dev"
"-DINITSYS=systemd"
"-DCLIENT=${boolToFlag buildClient}"
"-DSERVER=${boolToFlag buildServer}"
"-DSERVERGUI=${boolToFlag buildServerGui}"
"-DTOOLS=${boolToFlag buildExtraTools}"
"-DKIS_TABLET=${boolToFlag enableKisTablet}"
];
meta = {
description = "A collaborative drawing program that allows multiple users to sketch on the same canvas simultaneously";
homepage = "https://drawpile.net/";
downloadPage = "https://drawpile.net/download/";
license = licenses.gpl3;
maintainers = with maintainers; [ fgaz ];
platforms = platforms.unix;
};
}