diff --git a/README.md b/README.md index ae9ea07..357490c 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDS substituters = https://cache.nixos.org https://cache.dhall-lang.org ``` -If you use an older version of Nix (i.e. Nix 1.*) then use these options +If you use an older version of Nix (i.e. Nix `1.*`) then use these options instead: ``` @@ -137,6 +137,9 @@ $ nix-env --install --file default.nix ... or you can run the same command within each package's respective directory to install just that one package. +If you prefer installing the binaries locally in a nix shell environment instead, just run `nix-shell` in the top-level directory. +This option provides additional flexibility with respect to overriding some of the default parameters e.g. the compiler version, which makes it particularly useful for developers. + You can develop any package by navigating to that package's directory and running: diff --git a/nix/shared.nix b/nix/shared.nix index 921c6d8..9f2978f 100644 --- a/nix/shared.nix +++ b/nix/shared.nix @@ -563,6 +563,8 @@ in rec { inherit trivial; + inherit pkgs; + possibly-static = { dhall = makeStaticIfPossible "dhall" ; dhall-bash = makeStaticIfPossible "dhall-bash" ; diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..ac8040b --- /dev/null +++ b/shell.nix @@ -0,0 +1,32 @@ +{ args ? {} , shell ? "bash" }: +let + shared = import ./nix/shared.nix args; + static = shared.possibly-static; +in +shared.pkgs.runCommand "dhall-shell-${shell}" { + buildInputs = [ + static.dhall + static.dhall-json + static.dhall-text + static.dhall-bash + static.dhall-nix + ]; + shellHook = '' + echo "Dhall core tools shell" + echo "USAGE EXAMPLES" + echo " Default (GHC version ${(import ./nix/shared.nix {}).pkgs.haskellPackages.ghc.version}, option completions shell - bash):" + echo " $ nix-shell" + echo " Overriding default GHC compiler (see ./nix/shared.nix for available options):" + echo " $ nix-shell --arg args '{ compiler = "ghc7103"; }'" + echo " Overriding option completion shell flavor:" + echo " $ nix-shell --argstr shell zsh" + + source <(dhall --${shell}-completion-script dhall) + source <(dhall-to-text --${shell}-completion-script dhall-to-text) + source <(dhall-to-bash --${shell}-completion-script dhall-to-bash) + source <(dhall-to-nix --${shell}-completion-script dhall-to-nix) + source <(dhall-to-json --${shell}-completion-script dhall-to-json) + source <(dhall-to-yaml --${shell}-completion-script dhall-to-yaml) + source <(json-to-dhall --${shell}-completion-script json-to-dhall) + ''; +} ""