It is possible to build smos using Stack, but this method is mainly available for development purposes. In practice we recommend using Nix for installing Smos.
-
Clone the repository:
git clone https://github.com/NorfairKing/smos
-
Decide whether you want to build the
smos-server
executable. If you just want to usesmos
,smos-query
and the other command-line executables, the answer will be "no". In that case, you can remove thestripe-client
line from thestack.yaml
file and continue to the next step.If you do want to build
smos-server
, then you need to generate thestripe-client
package.-
If you have nix installed, you can run this command and skip the rest of this step:
./scripts/generate-stripe.sh
-
Get the stripe OpenAPI spec. The
smos/nix/overlay.nix
file specifies the version ofstripe-spec
to use. You will need theopenapi/spec3.yaml
file from that repository. -
Get the openapi3 client code generator:
stack install openapi3-code-generator --stack-yaml setup-stack.yaml
-
Generate the
stripe-client
library using this command:~/.local/bin/openapi3-code-generator-exe --specification /path/to/openapi/spec3.yaml --configuration stripe-client-gen.yaml
-
-
Install prerequisites:
stack install autoexporter
-
Install Smos with the default configuration:
stack install smos
-
You probably want to also install related tools:
stack install smos-query stack install smos-archive stack install smos-single stack install smos-sync-client
Troubleshooting
Stripe client
/home/user/src/smos/stripe-client/: getDirectoryContents:openDirStream: does not exist (No such file or directory)
If you see the above error, you probably skipped the "Generate the stripe client" steps above. This happens because we generate the stripe client based on the openapi3 spec for Stripe's api. This generated code is not committed to the repository.
Autoconf
You may get an error about autoreconf
not being available if autoconf
is not installed.
Make sure that you have autoreconf
on your path.
Arch linux
Do not install stack
or any other haskell packages using pacman.
This is unlikely to build at all and will most likely cause in bugs if it does.
Instead, install stack
by following the documentation on this page