我剛開始在OSX上使用Nix包管理器,並且正在嘗試爲pass
二進制文件(https://www.passwordstore.org)創建我的第一個包 - 這在Nixpkgs存儲庫中不可用。指定Nix包運行時依賴關係
我試圖指定一個運行時依賴項(getopt
),但是當使用二進制文件時,這似乎不可用。
這是我包的default.nix:
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
version = "1.7.1";
in {
pass = stdenv.mkDerivation rec {
name = "pass-${version}";
src = fetchurl {
url = "https://git.zx2c4.com/password-store/snapshot/password-store-1.7.1.tar.xz";
sha256 = "0scqkpll2q8jhzcgcsh9kqz0gwdpvynivqjmmbzax2irjfaiklpn";
};
buildInputs = [ stdenv makeWrapper];
installPhase = ''
make install PREFIX=$out/artifact
makeWrapper $out/artifact/bin/pass $out/bin/pass \
--set PATH ${stdenv.lib.makeBinPath [ getopt ]}
'';
meta = {
homepage = "https://www.passwordstore.org";
description = "The standard unix password manager";
license = stdenv.lib.licenses.gpl2Plus;
};
};
}
我可以成功地建立這個包(nix-build --show-trace
)並安裝它(nix-env -i ./result
)。
清單我的包在運行時依賴顯示getopt
上市:
nix-store -qR $(which pass)
...
/nix/store/c5swmygzc0kmvpq6cfkvwm2yz1k57kqy-getopt-1.1.4
但是當我來到使用二進制(pass init my-key
)我得到以下錯誤:
/nix/store/...-pass-1.7.1/artifact/bin/pass: line 302:
/usr/local/bin/getopt: No such file or directory
誰能指教一下我做錯了?
感謝
好像密碼店內一些硬編碼路徑。你可能需要修補這些。 –
您可能應該省略.../artifact,因爲生態系統的其他部分會假設二進制文件位於/bin中,而不是/artifact/bin。 (可能不是你的問題的原因,雖然) –
有趣的事實:你可以取消引用網址。 –