-
Notifications
You must be signed in to change notification settings - Fork 1
/
package.nix
107 lines (98 loc) · 2.06 KB
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{
version,
lib,
installShellFiles,
rustPlatform,
makeWrapper,
ffmpeg,
grim,
procps,
rofi-wayland,
slurp,
tesseract,
hyprpicker,
wf-recorder,
wl-clipboard,
xdg-utils,
hyprland,
sway,
backend ? "hyprland",
ocr ? true,
video ? true,
}:
assert lib.assertOneOf "backend" backend [
"hyprland"
"sway"
];
rustPlatform.buildRustPackage {
pname = "focal";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.difference ./. (
# don't include in build
lib.fileset.unions [
./README.md
./LICENSE
# ./PKGBUILD
]
);
};
inherit version;
# inject version from nix into the build
env.NIX_RELEASE_VERSION = version;
cargoLock.lockFile = ./Cargo.lock;
cargoBuildFlags =
[
"--no-default-features"
"--features"
backend
]
++ lib.optionals video [
"--features"
"video"
]
++ lib.optionals ocr [
"--features"
"ocr"
];
nativeBuildInputs = [
installShellFiles
makeWrapper
];
postInstall = ''
for cmd in focal focal-waybar; do
installShellCompletion --cmd $cmd \
--bash <($out/bin/$cmd generate bash) \
--fish <($out/bin/$cmd generate fish) \
--zsh <($out/bin/$cmd generate zsh)
done
'';
postFixup =
let
binaries =
[
grim
procps
rofi-wayland
slurp
hyprpicker
wl-clipboard
xdg-utils
]
++ lib.optionals (backend == "hyprland") [ hyprland ]
++ lib.optionals (backend == "sway") [ sway ]
++ lib.optionals video [
ffmpeg
wf-recorder
]
++ lib.optionals ocr [ tesseract ];
in
"wrapProgram $out/bin/focal --prefix PATH : ${lib.makeBinPath binaries}";
meta = with lib; {
description = "Focal captures screenshots / videos using rofi, with clipboard support on hyprland";
mainProgram = "focal";
homepage = "https://github.com/iynaix/focal";
license = licenses.mit;
maintainers = [ maintainers.iynaix ];
};
}