-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.nix
More file actions
53 lines (45 loc) · 1.5 KB
/
package.nix
File metadata and controls
53 lines (45 loc) · 1.5 KB
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
{ lib
, rustPlatform
, installShellFiles
, makeWrapper
, bash
, yt-dlp
, brotli
, twitch_downloader
, twitch-chat-downloader
, python3Packages
}:
let manifest = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package;
in rustPlatform.buildRustPackage rec {
pname = manifest.name;
version = manifest.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
doCheck = false;
nativeBuildInputs = [ installShellFiles makeWrapper ];
postInstall = ''
echo Installing man page
assets_dir="$(dirname $(find -name archiver.1) | head -1)"
installManPage $assets_dir/archiver.1
echo Installing shell completion scripts
installShellCompletion --cmd archiver \
--bash $assets_dir/archiver.bash \
--fish $assets_dir/archiver.fish \
--zsh $assets_dir/_archiver
extra=$out/share/extra_completions
mkdir -p $extra/elvish $extra/fig $extra/powershell
cp $assets_dir/archiver.elv $out/share/extra_completions/elvish
cp $assets_dir/archiver.ts $out/share/extra_completions/fig
cp $assets_dir/_archiver.ps1 $out/share/extra_completions/powershell
'';
postFixup = ''
wrapProgram $out/bin/archiver \
--set PATH ${lib.makeBinPath [ bash yt-dlp brotli twitch_downloader python3Packages.chat-downloader twitch-chat-downloader ]}
'';
meta = with lib; {
description = manifest.description;
homepage = manifest.homepage;
changelog = "https://github.com/Assistant/archiver/blob/master/changelogs/v${version}.md";
license = licenses.mit;
};
}