uusi: Tweak .cabal files

[ distribution, library, mit, program ] [ Propose Tags ]

uusi is a command-line program to tweak .cabal files. It is used in distribution packaging. See README for details.

[Skip to Readme]


Maintainer's Corner

For package maintainers and hackage trustees


Versions [RSS],,,,,,,,, (info)
Change log CHANGELOG.md
Dependencies base (>=4.8 && <5), Cabal (>=3.2 && <3.3 || >=3.4 && <3.5), directory, filepath, text, uusi [details]
License MIT
Copyright 2020-2021 berberman
Author berberman
Maintainer berberman <berberman@yandex.com>
Category Distribution
Home page https://github.com/berberman/uusi
Bug tracker https://github.com/berberman/uusi/issues
Source repo head: git clone https://github.com/berberman/uusi.git
Uploaded by berberman at 2021-06-20T03:34:09Z
Distributions Arch:, NixOS:
Executables gen-setup, uusi
Downloads 1570 total (39 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-06-20 [all 1 reports]

Readme for uusi-

[back to package description]


GitHub CI Hackage MIT license

uusi is a simple command-line program to tweak Package Description. In distribution packaging, sometimes we need modify the version range of dependencies. Usually, this can be done by some *nix text processing utilities, such as awk, sed, etc. However, these tools process cabal files as plain text, not considering the semantics. Thus, it might be pesky or elusive to conver the entire cases. uusi has almost no extra dependencies, so it's safe to introduce uusi as build-depends of the target, which packagers can use to manipulate target's dependencies. Currently, uusi works in Arch Linux packaging, and you may find out that it has been required by many haskell packages. In most cases, it is used to loose the version constraint of a dependency when building a package, because the dependent haskell package provided by system may be too new to fit the constraints, whereas this package can be built against the newer dependency successfully.


# pacman -S uusi

Install it via pacman.


$ git clone https://github.com/berberman/uusi

If you choose to use dynamic haskell packages provided by Arch Linux, run to configure the project locally:

$ cabal configure --disable-library-vanilla --enable-shared --enable-executable-dynamic --ghc-options=-dynamic

Then build it:

$ cabal build


uusi will replace the text in .cabal file inplace. uusi supports four kinds of actions:

  • remove all version constraints of dependencies

  • overwrite a version range of a specific dependency

  • remove a dependency

  • replace a dependency with given packages

  • set the buildable of a component

  • modify ghc-options of a component

If no option is specified, uusi will use --all, removing all version constraints.

uusi provides an executable gen-setup to generate a boilerplate Setup.hs.


  • Set all dependencies' version ranges to any version:
$ uusi foo.cabal
  • Replace old-time with time:
$ uusi -rold-time:time foo.cabal
  • Remove semigroup:
$ uusi -dsemigroup foo.cabal
  • Overwrite base:
$ uusi -ubase: >=4.14 foo.cabal

Packages have pattern <pkgname> or <pkgname>:<version>. Run this program, and see help message for details.

  • Together:
$ uusi -ubar:2999.20.1.0 -dbase --all foo.cabal
  • Do not build foo-test:
$ uusi -nb foo-test foo.cabal
  • Add dynamic to ghc-options of foo-test:
$ uusi --add-options foo-test:-dynamic foo.cabal
  • Add -dynamic to ghc-options of all components:
$ uusi --add-options-all -dynamic foo.cabal
  • Remove -Wall and -dynamic from ghc-options of all components:
$ uusi --remove-options-all -Wall,-dynamic 


Issues and PRs are always welcome. _(:з」∠)_