2020-12-26 16:59:38 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
|
|
|
, linkFarmFromDrvs
|
|
|
|
, dotnet-netcore
|
|
|
|
, dotnet-sdk
|
|
|
|
, dotnetPackages
|
|
|
|
, dpkg
|
|
|
|
, gtk3
|
|
|
|
, libX11
|
|
|
|
, libXrandr
|
|
|
|
, libappindicator
|
|
|
|
, libevdev
|
|
|
|
, libnotify
|
|
|
|
, udev
|
2021-01-01 15:29:24 +01:00
|
|
|
, copyDesktopItems
|
2020-12-26 16:59:38 +01:00
|
|
|
, makeDesktopItem
|
2021-01-01 15:29:24 +01:00
|
|
|
, makeWrapper
|
2021-01-08 17:48:00 +01:00
|
|
|
, nixosTests
|
2020-12-26 16:59:38 +01:00
|
|
|
, wrapGAppsHook
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "OpenTabletDriver";
|
2021-02-04 01:38:24 +01:00
|
|
|
version = "0.5.1";
|
2020-12-26 16:59:38 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "InfinityGhost";
|
|
|
|
repo = "OpenTabletDriver";
|
|
|
|
rev = "v${version}";
|
2021-02-04 01:38:24 +01:00
|
|
|
sha256 = "1if2mkj193yzf5si9pwaynrm6wkhqy7ihk4k1lklzcryk5675w36";
|
2020-12-26 16:59:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
debPkg = fetchurl {
|
|
|
|
url = "https://github.com/InfinityGhost/OpenTabletDriver/releases/download/v${version}/OpenTabletDriver.deb";
|
2021-02-04 01:38:24 +01:00
|
|
|
sha256 = "16a1rr0yxra1dhwysbbfgsxpigh2jhjlsl7r28dgp8qcxncck7wg";
|
2020-12-26 16:59:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
dotnet-sdk
|
|
|
|
dotnetPackages.Nuget
|
|
|
|
dpkg
|
2021-01-01 15:29:24 +01:00
|
|
|
copyDesktopItems
|
2020-12-26 16:59:38 +01:00
|
|
|
makeWrapper
|
|
|
|
wrapGAppsHook
|
|
|
|
];
|
|
|
|
|
|
|
|
nugetDeps = linkFarmFromDrvs "${pname}-nuget-deps" (import ./deps.nix {
|
|
|
|
fetchNuGet = { name, version, sha256 }: fetchurl {
|
|
|
|
name = "nuget-${name}-${version}.nupkg";
|
|
|
|
url = "https://www.nuget.org/api/v2/package/${name}/${version}";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
runtimeDeps = [
|
|
|
|
gtk3
|
|
|
|
libX11
|
|
|
|
libXrandr
|
|
|
|
libappindicator
|
|
|
|
libevdev
|
|
|
|
libnotify
|
|
|
|
udev
|
|
|
|
];
|
|
|
|
|
|
|
|
configurePhase = ''
|
2021-01-01 15:29:24 +01:00
|
|
|
runHook preConfigure
|
|
|
|
|
2020-12-26 16:59:38 +01:00
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|
|
|
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|
|
|
|
|
|
|
nuget sources Add -Name nixos -Source "$PWD/nixos"
|
|
|
|
nuget init "$nugetDeps" "$PWD/nixos"
|
|
|
|
|
|
|
|
# FIXME: https://github.com/NuGet/Home/issues/4413
|
|
|
|
mkdir -p $HOME/.nuget/NuGet
|
|
|
|
cp $HOME/.config/NuGet/NuGet.Config $HOME/.nuget/NuGet
|
|
|
|
|
|
|
|
for project in OpenTabletDriver.{Console,Daemon,UX.Gtk}; do
|
|
|
|
dotnet restore --source "$PWD/nixos" $project
|
|
|
|
done
|
2021-01-01 15:29:24 +01:00
|
|
|
|
|
|
|
runHook postConfigure
|
2020-12-26 16:59:38 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
2021-01-01 15:29:24 +01:00
|
|
|
runHook preBuild
|
|
|
|
|
2020-12-26 16:59:38 +01:00
|
|
|
for project in OpenTabletDriver.{Console,Daemon,UX.Gtk}; do
|
|
|
|
dotnet build $project \
|
|
|
|
--no-restore \
|
|
|
|
--configuration Release \
|
|
|
|
--framework net5
|
|
|
|
done
|
2021-01-01 15:29:24 +01:00
|
|
|
|
|
|
|
runHook postBuild
|
2020-12-26 16:59:38 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-01-01 15:29:24 +01:00
|
|
|
runHook preInstall
|
2020-12-26 16:59:38 +01:00
|
|
|
|
|
|
|
for project in OpenTabletDriver.{Console,Daemon,UX.Gtk}; do
|
|
|
|
dotnet publish $project \
|
|
|
|
--no-build \
|
|
|
|
--no-self-contained \
|
|
|
|
--configuration Release \
|
|
|
|
--framework net5 \
|
|
|
|
--output $out/lib
|
|
|
|
done
|
|
|
|
|
|
|
|
# Give a more "*nix" name to the binaries
|
|
|
|
makeWrapper $out/lib/OpenTabletDriver.Console $out/bin/otd \
|
|
|
|
"''${gappsWrapperArgs[@]}" \
|
|
|
|
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
|
|
|
|
--set DOTNET_ROOT "${dotnet-netcore}" \
|
|
|
|
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}"
|
|
|
|
|
|
|
|
makeWrapper $out/lib/OpenTabletDriver.Daemon $out/bin/otd-daemon \
|
|
|
|
"''${gappsWrapperArgs[@]}" \
|
|
|
|
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
|
|
|
|
--set DOTNET_ROOT "${dotnet-netcore}" \
|
|
|
|
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}"
|
|
|
|
|
|
|
|
makeWrapper $out/lib/OpenTabletDriver.UX.Gtk $out/bin/otd-gui \
|
|
|
|
"''${gappsWrapperArgs[@]}" \
|
|
|
|
--prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
|
|
|
|
--set DOTNET_ROOT "${dotnet-netcore}" \
|
|
|
|
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}"
|
|
|
|
|
2021-01-01 15:29:24 +01:00
|
|
|
mkdir -p $out/lib/OpenTabletDriver
|
|
|
|
cp -rv ./OpenTabletDriver/Configurations $out/lib/OpenTabletDriver
|
|
|
|
install -Dm644 $src/OpenTabletDriver.UX/Assets/otd.png -t $out/share/pixmaps
|
2020-12-26 16:59:38 +01:00
|
|
|
|
2021-01-01 15:29:24 +01:00
|
|
|
# TODO: Ideally this should be build from OpenTabletDriver/OpenTabletDriver-udev instead
|
2021-01-19 15:33:01 +01:00
|
|
|
dpkg-deb --fsys-tarfile ${debPkg} | tar xf - ./usr/lib/udev/rules.d/99-opentabletdriver.rules
|
|
|
|
install -Dm644 ./usr/lib/udev/rules.d/99-opentabletdriver.rules -t $out/lib/udev/rules.d
|
2020-12-26 16:59:38 +01:00
|
|
|
|
2021-01-01 15:29:24 +01:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
2020-12-26 16:59:38 +01:00
|
|
|
desktopName = "OpenTabletDriver";
|
|
|
|
name = "OpenTabletDriver";
|
|
|
|
exec = "otd-gui";
|
|
|
|
icon = "otd";
|
|
|
|
comment = meta.description;
|
|
|
|
type = "Application";
|
|
|
|
categories = "Utility;";
|
2021-01-01 15:29:24 +01:00
|
|
|
})
|
|
|
|
];
|
2020-12-26 16:59:38 +01:00
|
|
|
|
|
|
|
dontWrapGApps = true;
|
|
|
|
dontStrip = true;
|
|
|
|
|
2021-01-19 15:18:21 +01:00
|
|
|
passthru = {
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
tests = {
|
|
|
|
otd-runs = nixosTests.opentabletdriver;
|
|
|
|
};
|
2021-01-08 17:48:00 +01:00
|
|
|
};
|
|
|
|
|
2020-12-26 16:59:38 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Open source, cross-platform, user-mode tablet driver";
|
|
|
|
homepage = "https://github.com/InfinityGhost/OpenTabletDriver";
|
|
|
|
license = licenses.lgpl3Plus;
|
|
|
|
maintainers = with maintainers; [ thiagokokada ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|