MyNixOS website logo

cabal-scaffold - Scaffolding Tool for Cabal-based Projects with Stackage Snapshots

cabal-scaffold provides a cabal-analogue of stack new. It automatically downloads cabal.project.freeze corresponding to the specified Stackage Snapshot.

Usage

Usage: cabal-scaffold new [--resolver ARG] [-p|--param KEY:VALUE] 
                          [-w|--with-compiler COMPILER] PROJECT_NAME [TEMPLATE]

  Create New Project

Available options:
  --resolver ARG           Stackage resolver (default: lts)
  -p,--param KEY:VALUE     Parameters to specify explicitly
  -w,--with-compiler COMPILER
                           The compiler to use in the project
  PROJECT_NAME             Project name
  TEMPLATE                 Template Name or path
  -h,--help                Show this help text

Example Usage

Create a new project my-new-package with the default template, resolver, and compiler:

cabal-scaffold new my-new-package

Create a package by specifying the template name:

cabal-scaffold new my-new-package my-template

Create a package by specifying the path to the template:

cabal-scaffold new my-new-package ./path/to/my-template.hsfiles

Create a package with specified template, resolver, compiler, and custom params:

cabal-scaffold new -p category:Network --resolver lts-20.1 --with-compiler ghc-9.2.6 my-new-package default

Resolvers can be specified partially (resolved by querying to stackage):

cabal-scaffold new --resolver lts my-new-package

cabal-scaffold new --resolver lts-20 my-new-package

cabal-scaffold new --resolver nightly my-new-package

Configuration

Save the following as ${XDG_CONFIG_HOME}/cabal-scaffold.yaml (by default, it is equivalent to ~/.config/cabal-scaffold.yaml):

templateDirs: []
hpack: true

defaults:
  template: default
  snapshot: lts-20

params: 
  author-name: Your Name
  author-email: [email protected]
  # github-username: octcat

Templates

Templates must be placed under ${XDG_DATA_HOME}/cabal-scaffold (defaulted to ~/.local/share/cabal-scaffold). The format is the same as the one used by stack; i.e. hsfiles format. You can just copy templates from ~/.stack/templates, or adding ~/.stack/templates to templateDirs config item.

Templates in the scope can be inspected by cabal-scaffold expand command:

Usage: cabal-scaffold expand TEMPLATE [DIR]

  Search and expand the template to the specified directory

Available options:
  TEMPLATE                 The template to expand
  DIR                      The directory to put the expanded template
  -h,--help                Show this help text

Directory or hsfiles can be imported by cabal-scaffold import command:

Usage: cabal-scaffold import [-S|--override] PATH [TEMPLATE_NAME]

  Import directory or .hsfiles as a new preset template

Available options:
  -S,--override            If on, this will overrides the existing templates
  PATH                     The path to the hsfiles tempalte-file or directory to
                           import as a template
  TEMPLATE_NAME            The name of the template. If omitted, uses the base
                           name (without extension) of input template path.
  -h,--help                Show this help text
Metadata

Version

0.1.0.0

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows