我正在尝试为 Nix 打包一个 python 应用程序,但我发现大多数文档都假设我想要打包一个库。
为了做到这一点,我查看了 Rednotebook 示例(不是出于任何特殊原因,只是我碰巧知道它是用 python 编写的),它可以在python-packages中找到,但由于该文件非常大,这里是相关部分:
redNotebook = buildPythonPackage rec {
name = "rednotebook-1.8.1";
src = pkgs.fetchurl {
url = "mirror://sourceforge/rednotebook/${name}.tar.gz";
sha256 = "00b7s4xpqpxsbzjvjx9qsx5d84m9pvn383c5di1nsfh35pig0rzn";
};
# no tests available
doCheck = false;
propagatedBuildInputs = with self; [ pygtk pywebkitgtk pyyaml chardet ];
meta = {
homepage = http://rednotebook.sourceforge.net/index.html;
description = "A modern journal that includes a calendar navigation, customizable templates, export functionality and word clouds";
license = licenses.gpl2;
maintainers = with maintainers; [ tstrobel ];
};
};
我的推导如下:
{ pkgs ? import <nixpkgs> {} }:
let
requirements = import ./nix/requirements.nix { inherit pkgs; };
in
pkgs.python35Packages.buildPythonPackage rec {
name = "package-name";
version = "1.0.0";
namePrefix = "";
src = ./.;
doCheck = false;
propagatedBuildInputs = builtins.attrValues requirements.packages;
}
requirements.nix
是“派生列表”的输出pypi2nix
并requirements.packages
具有“派生列表”类型。尽管如此,当我 cd 进入 Rednotebook 的结果存储路径时,还是有一个/bin
包含一些包装脚本的目录。我的应用程序的商店路径只是一个lib
否/bin
我如何告诉 Nixpkgs 我有一个应用程序?