about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/tr/trigger-control/package.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-12-01 19:00:09 +0100
committerAlyssa Ross <hi@alyssa.is>2023-12-01 19:00:09 +0100
commit9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d (patch)
tree4368f9e4cb2d5b93a956c085337e45cb70f1e331 /nixpkgs/pkgs/by-name/tr/trigger-control/package.nix
parenta9cbfb6941b47d6f50129e6e36927882392daed7 (diff)
parent2344fe1da14cb08b0c18743b207995f9b8597915 (diff)
downloadnixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.gz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.bz2
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.lz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.xz
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.tar.zst
nixlib-9e9b07490d5bab5d115c66b80bdb10ff0c11ed8d.zip
Merge https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/by-name/tr/trigger-control/package.nix')
-rw-r--r--nixpkgs/pkgs/by-name/tr/trigger-control/package.nix82
1 files changed, 82 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/tr/trigger-control/package.nix b/nixpkgs/pkgs/by-name/tr/trigger-control/package.nix
new file mode 100644
index 000000000000..b0a389e29ec4
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/tr/trigger-control/package.nix
@@ -0,0 +1,82 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, makeWrapper
+, pkg-config
+, SDL2
+, dbus
+, libdecor
+, libnotify
+, dejavu_fonts
+, gnome
+}:
+
+let
+  inherit (gnome) zenity;
+in
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "trigger-control";
+  version = "1.5.1";
+
+  src = fetchFromGitHub {
+    owner = "Etaash-mathamsetty";
+    repo = "trigger-control";
+    # upstream does not use consistant tags pattern, so we use git commit hash
+    # https://github.com/Etaash-mathamsetty/trigger-control/tags
+    rev = "7b46e743227830d3a97720067d0a6cf20133af90";
+    hash = "sha256-nWSvsgksZ4Cxy1+i0xy8pNalgsiAuaqxNVwT/CThaBI=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    makeWrapper
+    pkg-config
+  ];
+
+  buildInputs = [
+    SDL2
+    dbus
+    libnotify
+  ] ++ lib.optionals stdenv.isLinux [
+    libdecor
+  ];
+
+  patches = [
+    # Fix build on clang https://github.com/Etaash-mathamsetty/trigger-control/pull/23
+    (fetchpatch {
+      name = "clang.patch";
+      url = "https://github.com/Etaash-mathamsetty/trigger-control/commit/bbec33296fdac7e2ca0398ae19ca8de8ad883407.patch";
+      hash = "sha256-x6RymdzBlzAJ8O8QGqXQtvkZkjdTaC5X8syFPunqZik=";
+    })
+  ];
+
+  # The app crashes without a changed fontdir and upstream recommends dejavu as font
+  postPatch = ''
+    substituteInPlace trigger-control.cpp --replace "/usr/share/fonts/" "${dejavu_fonts}/share/fonts/"
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -D trigger-control $out/bin/trigger-control
+
+    runHook postInstall
+  '';
+
+  postInstall = lib.optionalString stdenv.isLinux ''
+    wrapProgram $out/bin/trigger-control \
+      --prefix PATH : ${lib.makeBinPath [ zenity ]}
+  '';
+
+  meta = with lib; {
+    description = "Control the dualsense's triggers on Linux (and Windows) with a gui and C++ api";
+    homepage = "https://github.com/Etaash-mathamsetty/trigger-control";
+    license = licenses.mit;
+    mainProgram = "trigger-control";
+    maintainers = with maintainers; [ azuwis ];
+    platforms = platforms.all;
+  };
+})