Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on Adding dependency with cabal in gitlab-ci

Post

Adding dependency with cabal in gitlab-ci

+2
−0

I have a project I normally build with nix and cabal, however I also want to publish my documentation onto gitlab pages. It's impractical to run my nix on the gitlab CI, so I've just been using cabal. Here was my .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

And here's my 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

This worked until I needed to use text-icu. I added text-icu to my nix and package.yaml:

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

And this works on my local machine just fine. But I can't use my nix on gitlab CI and gitlab's docker image doesn't have text-icu. So I get an error:

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

How can I supply this dependency to the gitlab-ci so that cabal can access it?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

How to install haskell/cabal dependencies? (1 comment)
How to install haskell/cabal dependencies?
milohax‭ wrote 7 months ago

I'm not familiar with cabal and haskell, only gitlab-ci :) Did you add the updated packages.yml to your project so that it would be cloned into the GitLab runner? Is that enough to make cabal pick it up, or do you need to convert to a project file for cabal?

If there is a command to install the dependencies, you could run that before calling cabal.