justinwoo / spago2nix

Generate a derivation of (old) Spago dependencies, and use them to install them into the directory structure used by Spago.
MIT License
42 stars 23 forks source link

feat: generate option -> add `INPUT` and `OUTPUT` arguments` #18

Closed srghma closed 4 years ago

srghma commented 4 years ago

e.g. using bower2nix one can write

bower2nix $src_dir/bower.json $script_dir/generated/bower2nix-bower-components.nix

$ bower2nix --help
usage: .bower2nix-wrapped [-h] [-v] [INPUT] [OUTPUT]

Generate nix expressions to fetch bower dependencies

Positional arguments:
  INPUT          The bower.json file (default: ./bower.json)
  OUTPUT         The output file to generate (default: stdout)

Optional arguments:
  -h, --help     Show this help message and exit.
  -v, --version  Show program's version number and exit.
srghma commented 4 years ago

better

help :: String
help = """spago2nix - generate Nix derivations from packages required in a spago project, and allow for installing them and building them.

  Usage: spago2nix (generate | install | build)

Available commands:
  generate [--project-dir PROJECT-DIR] [--output OUTPUT] [--cache-dir CACHE-DIR]
    Generate a Nix expression of packages from Spago

    Optional arguments:
      PROJECT-DIR    The directory with ./spago.dhall and ./packages.dhall file (default: $CWD)
      OUTPUT         The output file to generate (default: ./spago-packages.nix)
      CACHE-DIR      The cache dir to generate (default: ./.spago2nix/)

  install [passthrough args for nix-shell]
    Install dependencies from spago-packages.nix in Spago style
  build [passthrough args for nix-shell]
    Build the project Spago style
  build-nix [passthrough args for nix-shell]
    Build the project using dependency sources from Nix store
"""