Merge pull request #108131 from thiagokokada/opentabletdriver-misc-improvements
opentabletdriver: misc improvements to package/module
This commit is contained in:
commit
e10ef1faec
2 changed files with 37 additions and 16 deletions
|
@ -24,6 +24,15 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.opentabletdriver;
|
||||
defaultText = "pkgs.opentabletdriver";
|
||||
description = ''
|
||||
OpenTabletDriver derivation to use.
|
||||
'';
|
||||
};
|
||||
|
||||
daemon = {
|
||||
enable = mkOption {
|
||||
default = true;
|
||||
|
@ -37,9 +46,9 @@ in
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ opentabletdriver ];
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
services.udev.packages = with pkgs; [ opentabletdriver ];
|
||||
services.udev.packages = [ cfg.package ];
|
||||
|
||||
boot.blacklistedKernelModules = cfg.blacklistedKernelModules;
|
||||
|
||||
|
@ -50,7 +59,7 @@ in
|
|||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${opentabletdriver}/bin/otd-daemon -c ${opentabletdriver}/lib/OpenTabletDriver/Configurations";
|
||||
ExecStart = "${cfg.package}/bin/otd-daemon -c ${cfg.package}/lib/OpenTabletDriver/Configurations";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue