我需要从一个带有Postgres模板的项目堆栈创建Nix包。
基本上是这样的:我有一个安装了NixOS的虚拟机,我需要将我的项目移植到另一个安装了NixOS的虚拟机。为此,我将使用nix copy命令,但在此之前,我需要以某种方式“安装”我的项目,使其位于/nix/store目录中。
我尝试通过查看另一个发布的问题“从stack项目生成Nix包”来做同样的事情。
来吧。我所做的是:
如果源码分布在多个目录中,如何指示nix?
基本上是这样的:我有一个安装了NixOS的虚拟机,我需要将我的项目移植到另一个安装了NixOS的虚拟机。为此,我将使用nix copy命令,但在此之前,我需要以某种方式“安装”我的项目,使其位于/nix/store目录中。
我尝试通过查看另一个发布的问题“从stack项目生成Nix包”来做同样的事情。
来吧。我所做的是:
cd /home/ProjetoApp
stack new TesteYesod yesod-postgres
cd TestYesod
stack init --resolver lts-11.22
stack install yesod-bin --install-ghc
我在 stack.yaml 文件中添加了:
nix
pure: true
enable: true
packages: [postgresql]
目前为止一切顺利。我只能编译和执行堆栈。然后我尝试生成一个nix包。在stack.yaml中,我做了以下操作:
nix
pure: true
enable: true
shell-file: default.nix
在 default.nix 文件中,我做了以下操作:
{nixpkgs ? import <nixpkgs> { }, ghc ? nixpkgs.ghc}:
with nixpkgs;
haskell.lib.buildStackProject {
name ="teste-yesod-1.0.0";
src = ./.;
buildInputs = [ postgresql ];
inherit ghc;
}
如果我这样做:
nix build
发生时间:
builder for '/nix/store/rckhmkgrkb6nzn7dkqqldfdm8cilpya2-teste-yesod
1.0.0.drv' failed with exit code 1; last 5 log lines:
unpacking sources
unpacking source archive /nix/store/
n62hzn4igi1b7khksa6sp3cq8gk4h344-TesteYesod
source root is TestYesod
patching sources
configuring
[0 built (1 failed), 0.0 MiB DL]
error: build of '/nix/store/rckhmkgrkb6nzn7dkqqldfdm8cilpya2-teste-yesod-
1.0.0.drv' failed
如果源码分布在多个目录中,如何指示nix?
nix-build --debug
。 - Chris Stryczynski