diff --git a/Changelog.md b/Changelog.md
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,3 +1,10 @@
+### 0.5.4.0
+
+- *nhm-tool*: command *init* now generates file *hie.yaml* for using with
+  *haskell-language-server* when editing the Haskell source file(s). The
+  generated *Makefile* skips configuration of the GHC environment if this can
+  be omitted, the GHC environment is not deleted on *make clean*.
+
 ### 0.5.3.2
 
 - *nhm-tool*: actually apply changes from *0.5.3.1*, they were not applied due
diff --git a/NgxExport/Distribution.hs b/NgxExport/Distribution.hs
--- a/NgxExport/Distribution.hs
+++ b/NgxExport/Distribution.hs
@@ -276,13 +276,13 @@
 -- > $ nhm-tool init project-name
 --
 -- produces files /cabal.project/, /Setup.hs/, /project-name.cabal/, /Makefile/,
--- and /project_name.hs/. If any of the former four files exist, add option /-f/
--- to override them.
+-- /project_name.hs/, and /hie.yaml/. If any of the files exist, add option /-f/
+-- to override them. File /project_name.hs/ is not overridable.
 --
--- Note that the root Haskell source file is /project_name.hs/ where
--- /project_name/ is /project-name/ with all dashes replaced by underscores. If
--- the source code will depend on packages other than /base/ and /ngx-export/,
--- add them into /project-name.cabal/ manually.
+-- Note that the Haskell source file is /project_name.hs/ where /project_name/
+-- is /project-name/ with all dashes replaced by underscores. If the source code
+-- will depend on packages other than /base/ and /ngx-export/, add them into
+-- /project-name.cabal/ manually.
 --
 -- By default, the target library will be linked against the threaded Haskell
 -- RTS library. To link against the base RTS library, add option /-no-threaded/.
@@ -303,9 +303,23 @@
 --
 -- > $ make clean
 --
--- or, to additionally delete the built artifact,
+-- or, to additionally delete the GHC environment file and the built artifact,
 --
 -- > $ make clean-all
+--
+-- To just create the GHC package environment, run
+--
+-- > $ make env
+--
+-- This is enough to start editing the Haskell source file in an editor which
+-- has support for the /Haskell Language Server/.
+--
+-- If you want to add more Haskell source files, add their names into variable
+-- /SRC/ in /Makefile/. If the root Haskell source file depends on modules from
+-- other source files, add their names (or module names) into the list of
+-- arguments in file /hie.yaml/. This is required for the Haskell Language
+-- Server to work correctly. Note also that in this case the names of the files
+-- must be equal to the names of the modules these files provide.
 
 -- $drawbacks
 --
diff --git a/ngx-export-distribution.cabal b/ngx-export-distribution.cabal
--- a/ngx-export-distribution.cabal
+++ b/ngx-export-distribution.cabal
@@ -1,5 +1,5 @@
 name:                       ngx-export-distribution
-version:                    0.5.3.2
+version:                    0.5.4.0
 synopsis:                   Build custom libraries for Nginx Haskell module
 description:                Build custom libraries for
         <https://github.com/lyokha/nginx-haskell-module Nginx Haskell module>.
diff --git a/nhm-tool.hs b/nhm-tool.hs
--- a/nhm-tool.hs
+++ b/nhm-tool.hs
@@ -50,6 +50,7 @@
                          , initDataForce :: Bool
                          , initDataToStdout :: Bool
                          , initDataProject :: String
+                         , initDataGhcOptions :: [String]
                          , initDataWaitArg :: Maybe String
                          , initDataHelp :: Bool
                          }
@@ -155,7 +156,7 @@
         "init" : args' -> do
             let initData = foldl parseInitArg (Just defaultArgs) args'
                 defaultArgs = InitData defaultInitDataPrefix False False False
-                    "" Nothing False
+                    "" ["-Wall", "-O2"] Nothing False
             case initData of
                 Nothing -> usage (Just HelpInit) False
                 Just initData'@InitData {..} ->
@@ -428,6 +429,7 @@
                  ,projectHs init'
                  ,False
                  )
+                ,("hie.yaml", hieYaml init', True)
                 ]
     forM_ files $
         if initDataToStdout
@@ -483,7 +485,7 @@
      \  build-depends:            base >= 4.8 && < 5\n\
      \                          , ngx-export\n\
      \\n\
-     \  ghc-options:             -Wall -O2\n"
+     \  ghc-options:             ", T.pack $ unwords initDataGhcOptions, "\n"
     ,if initDataNoThreaded
          then ""
          else
@@ -507,29 +509,35 @@
      \\n\
      \SRC := $(NAME).hs\n\
      \LIB := $(NAME).so\n\
-     \STUB := $(NAME)_stub.h\n\
      \DISTR := $(PKGNAME)-$(PKGVER).tar.gz\n\
      \\n\
+     \OBJS := $(SRC:.hs=.o)\n\
+     \HIOBJS := $(SRC:.hs=.hi)\n\
+     \DYNOBJS := $(SRC:.hs=.dyn_o)\n\
+     \DYNHIOBJS := $(SRC:.hs=.dyn_hi)\n\
+     \STUBS := $(SRC:.hs=_stub.h)\n\
+     \\n\
      \GHCVER := $(shell ghc --numeric-version)\n\
      \GHCENV := .ghc.environment.$(MACHINE)-$(KERNEL)-$(GHCVER)\n\
      \DEPLIBS := $(MACHINE)-$(KERNEL)-ghc-$(GHCVER)\n\
      \BUILDDIR := dist-nhm\n\
      \\n\
+     \.PHONY: all env clean\n\
+     \\n\
      \all: $(DISTR)\n\
      \\n\
-     \$(DISTR): $(SRC)\n\
+     \env: $(GHCENV)\n\
+     \\n\
+     \$(GHCENV): cabal.project $(PKGNAME).cabal\n\
      \\tcabal install --builddir=\"$(BUILDDIR)\" --lib --only-dependencies \\\n\
      \\t  --package-env .\n\
-     \\tsed -i 's/\\(^package-id \\)/--\\1/' $(GHCENV)\n\
-     \\tif test \"$(NHMTOOL)\" = nhm-tool && ! command -v nhm-tool >/dev/null; \
-     \\\\n\
-     \\tthen \\\n\
-     \\t  PATH=$$(dirname \\\n\
-     \\t    $$(cabal list-bin $(PKGDISTR) --builddir=\"$(BUILDDIR)\")):\
-     \$$PATH; \\\n\
-     \\tfi; \\\n\
-     \\t$(NHMTOOL) deps $(PKGNAME) -d \"$(BUILDDIR)\" >> $(GHCENV); \\\n\
-     \\trunhaskell --ghc-arg=-package=base \\\n\
+     \\tsed -i 's/\\(^package-id \\)/--\\1/' $(GHCENV)\n",
+     updatePath,
+     "\t$(NHMTOOL) deps $(PKGNAME) -d \"$(BUILDDIR)\" >> $(GHCENV)\n\
+     \\n\
+     \$(DISTR): $(GHCENV) $(SRC)\n",
+     updatePath,
+     "\trunhaskell --ghc-arg=-package=base \\\n\
      \\t  --ghc-arg=-package=$(PKGDISTR) Setup.hs configure \\\n\
      \\t  --builddir=\"$(BUILDDIR)\" \\\n\
      \\t  --package-db=clear --package-db=global \\\n\
@@ -548,16 +556,22 @@
      \\tinstall -d $(PREFIX)\n\
      \\ttar xf $(DISTR) -C $(PREFIX) --no-same-owner\n\
      \\n\
-     \.PHONY: clean\n\
-     \\n\
      \clean:\n\
      \\trm -rf $(BUILDDIR) $(DEPLIBS)\n\
-     \\trm -f $(GHCENV) $(STUB) $(NAME).hi $(NAME).o\n\
+     \\trm -f $(OBJS) $(HIOBJS) $(DYNOBJS) $(DYNHIOBJS) $(STUBS)\n\
      \\trm -f $(LIB)\n\
      \\n\
      \clean-all: clean\n\
-     \\trm -f $(DISTR)\n"
+     \\trm -f $(GHCENV) $(DISTR)\n"
     ]
+    where updatePath =
+              "\tif test \"$(NHMTOOL)\" = nhm-tool && ! command -v nhm-tool \
+              \>/dev/null; \\\n\
+              \\tthen \\\n\
+              \\t  PATH=$$(dirname \\\n\
+              \\t    $$(cabal list-bin $(PKGDISTR) \
+              \--builddir=\"$(BUILDDIR)\")):$$PATH; \\\n\
+              \\tfi; \\\n"
 
 projectHs :: InitData -> Text
 projectHs InitData {..} = T.concat
@@ -568,5 +582,13 @@
                                else (v :)
                     ) "" $ '_' : initDataProject
     ," where\n\n"
+    ]
+
+hieYaml :: InitData -> Text
+hieYaml InitData {..} = T.concat
+    ["cradle:\n\
+     \  direct:\n\
+     \    arguments: ["
+    ,T.pack $ intercalate ", " $ map show initDataGhcOptions, "]\n"
     ]
 
