2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2024-01-02 11:29:13 +00:00
|
|
|
, coreutils
|
2020-07-18 16:06:22 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-07-18 16:06:22 +00:00
|
|
|
, extra-cmake-modules
|
2023-05-24 13:37:59 +00:00
|
|
|
, dbus
|
2020-07-18 16:06:22 +00:00
|
|
|
, libX11
|
|
|
|
, libXi
|
|
|
|
, libXtst
|
|
|
|
, libnotify
|
2023-05-24 13:37:59 +00:00
|
|
|
, libxkbcommon
|
2020-07-18 16:06:22 +00:00
|
|
|
, openssl
|
|
|
|
, xclip
|
|
|
|
, xdotool
|
2023-05-24 13:37:59 +00:00
|
|
|
, setxkbmap
|
|
|
|
, wl-clipboard
|
|
|
|
, wxGTK32
|
2021-06-28 23:13:55 +00:00
|
|
|
, makeWrapper
|
2022-09-09 14:08:57 +00:00
|
|
|
, stdenv
|
|
|
|
, AppKit
|
|
|
|
, Cocoa
|
|
|
|
, Foundation
|
2023-05-24 13:37:59 +00:00
|
|
|
, IOKit
|
|
|
|
, Kernel
|
|
|
|
, AVFoundation
|
|
|
|
, Carbon
|
|
|
|
, QTKit
|
|
|
|
, AVKit
|
|
|
|
, WebKit
|
2024-06-05 15:53:02 +00:00
|
|
|
, System
|
2023-05-24 13:37:59 +00:00
|
|
|
, waylandSupport ? false
|
|
|
|
, x11Support ? stdenv.isLinux
|
|
|
|
, testers
|
|
|
|
, espanso
|
2020-07-18 16:06:22 +00:00
|
|
|
}:
|
2023-05-24 13:37:59 +00:00
|
|
|
# espanso does not support building with both X11 and Wayland support at the same time
|
|
|
|
assert stdenv.isLinux -> x11Support != waylandSupport;
|
|
|
|
assert stdenv.isDarwin -> !x11Support;
|
|
|
|
assert stdenv.isDarwin -> !waylandSupport;
|
2020-07-18 16:06:22 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "espanso";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "2.2-unstable-2024-05-14";
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-05-24 13:37:59 +00:00
|
|
|
owner = "espanso";
|
|
|
|
repo = "espanso";
|
2024-06-05 15:53:02 +00:00
|
|
|
rev = "8daadcc949c35a7b7aa20b7f544fdcff83e2c5f7";
|
|
|
|
hash = "sha256-4MArENBmX6tDVLZE1O8cuJe7A0R+sLZoxBkDvIwIVZ4=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
|
|
|
"yaml-rust-0.4.6" = "sha256-wXFy0/s4y6wB3UO19jsLwBdzMy7CGX4JoUt5V6cU7LU=";
|
|
|
|
};
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
extra-cmake-modules
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2021-06-28 23:13:55 +00:00
|
|
|
makeWrapper
|
2023-05-24 13:37:59 +00:00
|
|
|
wxGTK32
|
|
|
|
];
|
|
|
|
|
|
|
|
# Ref: https://github.com/espanso/espanso/blob/78df1b704fe2cc5ea26f88fdc443b6ae1df8a989/scripts/build_binary.rs#LL49C3-L62C4
|
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
buildFeatures = [
|
|
|
|
"modulo"
|
2024-06-05 15:53:02 +00:00
|
|
|
] ++ lib.optionals waylandSupport [
|
2023-05-24 13:37:59 +00:00
|
|
|
"wayland"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"vendored-tls"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
"native-tls"
|
2020-07-18 16:06:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2023-05-24 13:37:59 +00:00
|
|
|
wxGTK32
|
2022-09-09 14:08:57 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2023-05-24 13:37:59 +00:00
|
|
|
openssl
|
|
|
|
dbus
|
|
|
|
libnotify
|
|
|
|
libxkbcommon
|
2022-09-09 14:08:57 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
AppKit
|
|
|
|
Cocoa
|
|
|
|
Foundation
|
2023-05-24 13:37:59 +00:00
|
|
|
IOKit
|
|
|
|
Kernel
|
|
|
|
AVFoundation
|
|
|
|
Carbon
|
|
|
|
QTKit
|
|
|
|
AVKit
|
|
|
|
WebKit
|
2024-06-05 15:53:02 +00:00
|
|
|
System
|
2023-05-24 13:37:59 +00:00
|
|
|
] ++ lib.optionals waylandSupport [
|
|
|
|
wl-clipboard
|
|
|
|
] ++ lib.optionals x11Support [
|
|
|
|
libXi
|
|
|
|
libXtst
|
|
|
|
libX11
|
|
|
|
xclip
|
|
|
|
xdotool
|
2020-07-18 16:06:22 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
2024-01-02 11:29:13 +00:00
|
|
|
substituteInPlace scripts/create_bundle.sh \
|
2024-06-05 15:53:02 +00:00
|
|
|
--replace-fail target/mac/ $out/Applications/ \
|
|
|
|
--replace-fail /bin/echo ${coreutils}/bin/echo
|
2023-07-15 17:15:38 +00:00
|
|
|
patchShebangs scripts/create_bundle.sh
|
|
|
|
substituteInPlace espanso/src/res/macos/Info.plist \
|
2024-06-05 15:53:02 +00:00
|
|
|
--replace-fail "<string>espanso</string>" "<string>${placeholder "out"}/Applications/Espanso.app/Contents/MacOS/espanso</string>"
|
2023-07-15 17:15:38 +00:00
|
|
|
substituteInPlace espanso/src/path/macos.rs espanso/src/path/linux.rs \
|
2024-06-05 15:53:02 +00:00
|
|
|
--replace-fail '"/usr/local/bin/espanso"' '"${placeholder "out"}/bin/espanso"'
|
2023-07-15 17:15:38 +00:00
|
|
|
'';
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
# Some tests require networking
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
postInstall =
|
|
|
|
if stdenv.isDarwin then ''
|
|
|
|
EXEC_PATH=$out/bin/espanso BUILD_ARCH=current ${stdenv.shell} ./scripts/create_bundle.sh
|
|
|
|
'' else ''
|
|
|
|
wrapProgram $out/bin/espanso \
|
|
|
|
--prefix PATH : ${lib.makeBinPath (
|
|
|
|
lib.optionals stdenv.isLinux [
|
|
|
|
libnotify
|
|
|
|
setxkbmap
|
|
|
|
] ++ lib.optionals waylandSupport [
|
|
|
|
wl-clipboard
|
|
|
|
] ++ lib.optionals x11Support [
|
|
|
|
xclip
|
|
|
|
]
|
|
|
|
)}
|
|
|
|
'';
|
2021-06-28 23:13:55 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
passthru.tests.version = testers.testVersion {
|
|
|
|
package = espanso;
|
2024-06-05 15:53:02 +00:00
|
|
|
# remove when updating to a release version
|
|
|
|
version = "2.2.1";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-07-18 16:06:22 +00:00
|
|
|
description = "Cross-platform Text Expander written in Rust";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "espanso";
|
2020-07-18 16:06:22 +00:00
|
|
|
homepage = "https://espanso.org";
|
|
|
|
license = licenses.gpl3Plus;
|
2024-06-05 15:53:02 +00:00
|
|
|
maintainers = with maintainers; [ kimat pyrox0 n8henrie ];
|
2022-09-09 14:08:57 +00:00
|
|
|
platforms = platforms.unix;
|
2024-06-05 15:53:02 +00:00
|
|
|
# With apple_sdk_10_12,
|
|
|
|
# kCFURLVolumeAvailableCapacityForImportantUsageKey
|
|
|
|
# is undefined.
|
|
|
|
# With apple_sdk_11_0, there is an issue with
|
|
|
|
# kColorSyncGenericGrayProfile.
|
|
|
|
broken = stdenv.hostPlatform.system == "x86_64-darwin";
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
Espanso detects when you type a keyword and replaces it while you're typing.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|