在 gitlab-ci 中添加 cabal 依赖

问题描述 投票:0回答:1

我有一个通常使用 nix 和 cabal 构建的项目,但是我也想将我的文档发布到 gitlab 页面上。在 gitlab CI 上运行我的 nix 是不切实际的,所以我一直在使用 cabal。这是我的

.gitlab-ci.yaml
:

default:
  image: haskell:9

stages:
  - pages

pages:
  stage: pages
  artifacts:
    paths:
      - public
  script:
    - cabal v2-haddock --builddir=out
    - mv ./out/build/*/ghc-*/*-*/doc/html/*/ ./public

这是我的

package.yaml

name:                lib
version:             0.1.1.0
license:             AGPL
author:              Me
copyright:           2024 Me
extra-source-files:
  - README.md

dependencies:
  - base >= 4.14 && < 5
  - containers >= 0.6.5 && < 0.7

library:
  source-dirs:
    src

这一直有效,直到我需要使用

text-icu
。我在我的 nix 中添加了
text-icu
package.yaml
:

 dependencies:
   - base >= 4.14 && < 5
   - containers >= 0.6.5 && < 0.7
+  - text
+  - text-icu >= 0.7 && < 0.9

这在我的本地机器上运行得很好。但我无法在 gitlab CI 上使用我的 nix,而且 gitlab 的 docker 镜像没有

text-icu
。所以我得到一个错误:

Error: cabal: Could not resolve dependencies:
[__0] trying: lib-0.1.1.0 (user goal)
[__1] unknown package: text-icu (dependency of lib)
[__1] fail (backjumping, conflict set: lib, text-icu)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: lib, text-icu

我真的习惯使用nix,所以我不知道如何解决这个问题。我随机尝试了一些事情,希望他们能偶然解决问题,但他们没有,而且我没有任何明智的想法。我如何向 gitlab-ci 提供此依赖项以便 cabal 可以访问它?

haskell gitlab-ci cabal
1个回答
0
投票

如果 cabal 找不到

text-icu
,可能是因为本地包索引为空。您可以使用
cabal update
进行更新。

script:
- cabal update
- cabal haddock ...
© www.soinside.com 2019 - 2024. All rights reserved.