Add nix support (#45)
This commit is contained in:
56
flake.nix
Normal file
56
flake.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
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; };
|
||||
in
|
||||
{
|
||||
packages.default = 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
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user