nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rustPlatform,
6 protobuf,
7 installShellFiles,
8 writableTmpDirAsHomeHook,
9}:
10
11rustPlatform.buildRustPackage rec {
12 pname = "clipcat";
13 version = "0.24.0";
14
15 src = fetchFromGitHub {
16 owner = "xrelkd";
17 repo = "clipcat";
18 tag = "v${version}";
19 hash = "sha256-EEM2gwr5j3umpZqHnxCO81EZbLQ3nYGcxb6DBJ7AbC8=";
20 };
21
22 cargoHash = "sha256-6fS/LnfNi3rH4H61GCdLp6pnfGPIXJiY2dAwKdK5ofk=";
23
24 nativeBuildInputs = [
25 protobuf
26 installShellFiles
27 ]
28 ++ lib.optionals stdenv.hostPlatform.isDarwin [
29 # fix following error on darwin:
30 # objc/notify.h:1:9: fatal error: could not build module 'Cocoa'
31 writableTmpDirAsHomeHook
32 ];
33
34 checkFlags = [
35 # Some test cases interact with X11, skip them
36 "--skip=test_x11_clipboard"
37 "--skip=test_x11_primary"
38 ];
39
40 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
41 for cmd in clipcatd clipcatctl clipcat-menu clipcat-notify; do
42 installShellCompletion --cmd $cmd \
43 --bash <($out/bin/$cmd completions bash) \
44 --fish <($out/bin/$cmd completions fish) \
45 --zsh <($out/bin/$cmd completions zsh)
46 done
47 '';
48
49 meta = {
50 description = "Clipboard Manager written in Rust Programming Language";
51 homepage = "https://github.com/xrelkd/clipcat";
52 license = lib.licenses.gpl3Only;
53 platforms = lib.platforms.linux ++ lib.platforms.darwin;
54 maintainers = with lib.maintainers; [
55 xrelkd
56 bot-wxt1221
57 ];
58 mainProgram = "clipcatd";
59 };
60}