-
Notifications
You must be signed in to change notification settings - Fork 30
/
flake.nix
57 lines (51 loc) · 1.54 KB
/
flake.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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {self, nixpkgs, flake-utils}: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
yaMusic = pkgs.stdenv.mkDerivation {
name = "yandex-download-music";
version = "v1.5";
src = ./.;
nativeBuildInputs = [
pkgs.makeWrapper
];
buildInputs = [
pkgs.perl
(pkgs.buildEnv {
name = "rt-perl-deps";
paths = with pkgs.perlPackages; (requiredPerlModules [
FileUtil
MP3Tag
GetoptLongDescriptive LWPUserAgent
LWPProtocolHttps
HTTPCookies
MozillaCA
]);
})
];
installPhase = ''
mkdir -p $out/bin
cp src/ya.pl $out/bin/ya-music
# cat src/ya.pl | perl -p -e "s/basename\(__FILE__\)/'ya-music'/g" > $out/bin/ya-music
# chmod +x $out/bin/ya-music
'';
postFixup = ''
# wrapProgram will rename ya-music into .ya-music-wrapped
# so replace all __FILE__ calls
substituteInPlace $out/bin/ya-music \
--replace "basename(__FILE__)" "'ya-music'"
wrapProgram $out/bin/ya-music \
--prefix PERL5LIB : $PERL5LIB
'';
};
in
{
packages.default = yaMusic;
apps.default = flake-utils.lib.mkApp { drv = yaMusic; };
}
);
}