如何在 Nix 中使用特定版本的 Haskell 软件包?
How can I use a specific version of a Haskell package with Nix?
我只想在我用 Nix 构建的项目中使用最新版本的 pandoc
,即 Haskell 包。
这是我的 shell.nix 文件。注释掉的部分是我试图覆盖包版本的地方,但它似乎不起作用。
with import <nixpkgs> {};
( let
colormath = pkgs.python3Packages.buildPythonPackage rec {
pname = "colormath";
version = "3.0.0";
src = pkgs.python3Packages.fetchPypi{
inherit version;
inherit pname;
sha256 = "05qjycgxp3p2f9n6lmic68sxmsyvgnnlyl4z9w7dl9s56jphaiix";
};
buildInputs = [ pkgs.python3Packages.numpy pkgs.python3Packages.networkx ];
};
spacy_conll = pkgs.python3Packages.buildPythonPackage rec {
pname = "spacy_conll";
version = "1.0.1";
src = pkgs.python3Packages.fetchPypi{
inherit version;
inherit pname;
sha256 = "1wffwp539i3yvqx6dl3ki5fmmbrpqpnf0ymg5806czk0rh7843j7";
};
buildInputs = [ pkgs.python3Packages.spacy pkgs.python3Packages.packaging ];
};
# pandoc = pkgs.haskellPackages.pandoc.override {
# version = "2.9.1.1";
# };
in pkgs.mkShell {
shellHook = "eval $(egrep ^export ${ghc}/bin/ghc)";
buildInputs = with pkgs; [
(python3.withPackages (ps: with ps; [
matplotlib
spacy
pandas
spacy_models.en_core_web_md
jupyter
scikitlearn
nltk
altair
vega_datasets
cherrypy
dominate
plotly
colormath
falcon # Spacy server from Haskell Cookbook
spacy_conll
]))
(haskellPackages.ghcWithPackages (ps: with ps; [ lens pandoc roman-numerals doclayout ] ))
];
}
)
Pandoc 2.9.1.1 在 nixpkgs 中可用 haskellPackages.pandoc_2_9_1_1
。我建议您使用它而不是尝试覆盖包,因为依赖项存在一些差异。不过作为参考,这里是你将如何覆盖 haskellPackages
:
let
hsPkgs = pkgs.haskellPackages.override {
overrides = self: super: {
pandoc = pkgs.haskell.lib.overrideCabal super.pandoc {
version = "2.9.1.1";
sha256 = "0vc1ld57nv27gwq4mq0wdal8k2wxvsc0f3m2jwq9nkq7wbpwa8cx";
};
};
};
in pkgs.mkShell {
buildInputs = with pkgs; [
(hsPkgs.ghcWithPackages (ps: with ps; [ pandoc ] ))
];
}
我只想在我用 Nix 构建的项目中使用最新版本的 pandoc
,即 Haskell 包。
这是我的 shell.nix 文件。注释掉的部分是我试图覆盖包版本的地方,但它似乎不起作用。
with import <nixpkgs> {};
( let
colormath = pkgs.python3Packages.buildPythonPackage rec {
pname = "colormath";
version = "3.0.0";
src = pkgs.python3Packages.fetchPypi{
inherit version;
inherit pname;
sha256 = "05qjycgxp3p2f9n6lmic68sxmsyvgnnlyl4z9w7dl9s56jphaiix";
};
buildInputs = [ pkgs.python3Packages.numpy pkgs.python3Packages.networkx ];
};
spacy_conll = pkgs.python3Packages.buildPythonPackage rec {
pname = "spacy_conll";
version = "1.0.1";
src = pkgs.python3Packages.fetchPypi{
inherit version;
inherit pname;
sha256 = "1wffwp539i3yvqx6dl3ki5fmmbrpqpnf0ymg5806czk0rh7843j7";
};
buildInputs = [ pkgs.python3Packages.spacy pkgs.python3Packages.packaging ];
};
# pandoc = pkgs.haskellPackages.pandoc.override {
# version = "2.9.1.1";
# };
in pkgs.mkShell {
shellHook = "eval $(egrep ^export ${ghc}/bin/ghc)";
buildInputs = with pkgs; [
(python3.withPackages (ps: with ps; [
matplotlib
spacy
pandas
spacy_models.en_core_web_md
jupyter
scikitlearn
nltk
altair
vega_datasets
cherrypy
dominate
plotly
colormath
falcon # Spacy server from Haskell Cookbook
spacy_conll
]))
(haskellPackages.ghcWithPackages (ps: with ps; [ lens pandoc roman-numerals doclayout ] ))
];
}
)
Pandoc 2.9.1.1 在 nixpkgs 中可用 haskellPackages.pandoc_2_9_1_1
。我建议您使用它而不是尝试覆盖包,因为依赖项存在一些差异。不过作为参考,这里是你将如何覆盖 haskellPackages
:
let
hsPkgs = pkgs.haskellPackages.override {
overrides = self: super: {
pandoc = pkgs.haskell.lib.overrideCabal super.pandoc {
version = "2.9.1.1";
sha256 = "0vc1ld57nv27gwq4mq0wdal8k2wxvsc0f3m2jwq9nkq7wbpwa8cx";
};
};
};
in pkgs.mkShell {
buildInputs = with pkgs; [
(hsPkgs.ghcWithPackages (ps: with ps; [ pandoc ] ))
];
}