diff --git a/pkgs/tools/X11/opentabletdriver/default.nix b/pkgs/tools/X11/opentabletdriver/default.nix index 6f8f9e44cc4a..486cb50b7f39 100644 --- a/pkgs/tools/X11/opentabletdriver/default.nix +++ b/pkgs/tools/X11/opentabletdriver/default.nix @@ -2,7 +2,6 @@ , lib , fetchFromGitHub , fetchurl -, makeWrapper , linkFarmFromDrvs , dotnet-netcore , dotnet-sdk @@ -15,7 +14,9 @@ , libevdev , libnotify , udev +, copyDesktopItems , makeDesktopItem +, makeWrapper , wrapGAppsHook }: @@ -39,6 +40,7 @@ stdenv.mkDerivation rec { dotnet-sdk dotnetPackages.Nuget dpkg + copyDesktopItems makeWrapper wrapGAppsHook ]; @@ -62,6 +64,8 @@ stdenv.mkDerivation rec { ]; configurePhase = '' + runHook preConfigure + export HOME=$(mktemp -d) export DOTNET_CLI_TELEMETRY_OPTOUT=1 export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 @@ -76,20 +80,25 @@ stdenv.mkDerivation rec { for project in OpenTabletDriver.{Console,Daemon,UX.Gtk}; do dotnet restore --source "$PWD/nixos" $project done + + runHook postConfigure ''; buildPhase = '' + runHook preBuild + for project in OpenTabletDriver.{Console,Daemon,UX.Gtk}; do dotnet build $project \ --no-restore \ --configuration Release \ --framework net5 done + + runHook postBuild ''; installPhase = '' - mkdir -p $out/lib/OpenTabletDriver/ - cp -r ./OpenTabletDriver/Configurations/ $out/lib/OpenTabletDriver/ + runHook preInstall for project in OpenTabletDriver.{Console,Daemon,UX.Gtk}; do dotnet publish $project \ @@ -119,11 +128,19 @@ stdenv.mkDerivation rec { --set DOTNET_ROOT "${dotnet-netcore}" \ --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" - mkdir -p $out/share/{applications,pixmaps} + mkdir -p $out/lib/OpenTabletDriver + cp -rv ./OpenTabletDriver/Configurations $out/lib/OpenTabletDriver + install -Dm644 $src/OpenTabletDriver.UX/Assets/otd.png -t $out/share/pixmaps - cp -r $src/OpenTabletDriver.UX/Assets/* $out/share/pixmaps + # TODO: Ideally this should be build from OpenTabletDriver/OpenTabletDriver-udev instead + dpkg-deb --fsys-tarfile ${debPkg} | tar xf - ./usr/lib/udev/rules.d/30-opentabletdriver.rules + install -Dm644 ./usr/lib/udev/rules.d/30-opentabletdriver.rules -t $out/lib/udev/rules.d - cp -r ${makeDesktopItem { + runHook postInstall + ''; + + desktopItems = [ + (makeDesktopItem { desktopName = "OpenTabletDriver"; name = "OpenTabletDriver"; exec = "otd-gui"; @@ -131,13 +148,8 @@ stdenv.mkDerivation rec { comment = meta.description; type = "Application"; categories = "Utility;"; - }}/share/applications/* $out/share/applications - - # TODO: Ideally this should be build from OpenTabletDriver/OpenTabletDriver-udev instead - dpkg-deb --fsys-tarfile ${debPkg} | tar xf - ./usr/lib/udev/rules.d/30-opentabletdriver.rules - mkdir -p $out/lib/udev/rules.d - cp ./usr/lib/udev/rules.d/* $out/lib/udev/rules.d - ''; + }) + ]; dontWrapGApps = true; dontStrip = true;