Skip to content
No description, website, or topics provided.
Haskell Dhall
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
dhall-to-ssh-config
examples
resources
src/Dhall
test
.gitignore
ChangeLog.md
LICENSE
README.md
Setup.hs
package.yaml
stack.yaml

README.md

dhall-ssh-config

This is a tool for generating an ssh config file using the Dhall configuration language.

Why?

The Dhall site linked above explains some benefits of the language in general. The reasons to use Dhall + dhall-ssh-config for generating your ssh config in particular are:

  • Functions: This is the main one. Use functions to DRY up your config.
  • Type checking: Some limited type checking (though most fields are just Text values)
  • Enum checking: Fields accepting some enumerated set of values (ex. yes/no/ask) are checked when generating the config file. In the future more checks may be added (for example time formats).
  • Consistent formatting: Keep your Dhall config consistenly formatted with dhall format. The generated ssh config file will be in a consistent format.

Notes on types

The Dhall type of the config should be List SSHConfig, where SSHConfig is the type given at resources/SSHConfig.dhall + a host field that is either Text or List Text.

Because all the elements of the list must be of the same type, all the fields other than host are Optional. There is an empty config at resources/EmptySSHConfig.dhall that can be merged in to ensure each config is the same shape. See the examples.

The fields themselves are named the same as they are in the ssh_config man page with the first letter lowercased.

Running

To clone, build, and run:

git clone git@github.com:robertjlooby/dhall-ssh-config.git
cd dhall-ssh-config
stack exec dhall-to-ssh-config -- < path/to/sshConfig.dhall > path/to/ssh/config

To install using homebrew:

brew tap robertjlooby/homebrew
brew install dhall-to-ssh-config
dhall-to-ssh-config < path/to/sshConfig.dhall > path/to/ssh/config

Tests

  • stack test [--file-watch]
You can’t perform that action at this time.