【发布时间】:2019-06-21 23:13:04
【问题描述】:
我需要使用 postgres 模板从项目堆栈创建 nix 包。
基本上是这样的:我有一个带有 NixOS 的虚拟机,我需要将我的项目移植到另一个带有 NixOS 的虚拟机。为此,我将使用 nix 复制命令,但在我需要以某种方式“安装”我的项目使其位于 /nix/store 之前。
我在查看发布的另一个问题“从堆栈项目生成 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。
标签: haskell yesod haskell-stack nix