Add nix support (#45)
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -5,6 +5,9 @@
|
||||
[._]ss[a-gi-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# nix build
|
||||
result
|
||||
|
||||
# Session
|
||||
Session.vim
|
||||
Sessionx.vim
|
||||
|
||||
@@ -50,6 +50,11 @@ git clone https://github.com/kaimi-io/yandex-music-download.git
|
||||
cd yandex-music-download/src
|
||||
perl ya.pl -h
|
||||
```
|
||||
### Nix / NixOS
|
||||
```bash
|
||||
nix shell github:kaimi-io/yandex-music-download
|
||||
ya-music -h
|
||||
```
|
||||
### MacOS
|
||||
1. Install brew (https://brew.sh/).
|
||||
2. Run:
|
||||
|
||||
60
flake.lock
generated
Normal file
60
flake.lock
generated
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1700650476,
|
||||
"narHash": "sha256-V269pVJbPgXDdwCA6f2LRcIsnKg9K/RPE5gyxKkxty4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "cb502b4d17fb2912444b0b6e9813f71ba2ebbfd9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
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