Documentation

Lake.Config.Workspace

structure Lake.Workspace :

A Lake workspace -- the top-level package directory.

  • root : Package

    The root package of the workspace.

  • lakeEnv : Env

    The detected Lake.Env of the workspace.

  • lakeConfig : LoadedLakeConfig

    The Lake configuration from the system configuration file.

  • lakeCache : Cache

    The Lake cache.

  • lakeArgs? : Option (Array String)

    The CLI arguments Lake was run with. Used by lake update to perform a restart of Lake on a toolchain update. A value of none means that Lake is not restartable via the CLI.

  • packages : Array Package

    The packages within the workspace (in require declaration order with the root coming first).

  • packageMap : DNameMap NPackage

    Name-package map of packages within the workspace.

  • facetConfigs : DNameMap FacetConfig

    Configuration map of facets defined in the workspace.

Instances For
    @[implemented_by _private.Lake.Config.Workspace.0.Lake.OpaqueWorkspace.unsafeGet]
    @[implemented_by _private.Lake.Config.Workspace.0.Lake.OpaqueWorkspace.unsafeMk]

    Returns the names of the root modules of the package's default targets.

    Instances For
      @[inline]

      The path to the workspace's directory (i.e., the directory of the root package).

      Instances For
        @[inline]

        The workspace's configuration.

        Instances For
          @[inline]

          The path to the workspace' Lake directory relative to dir.

          Instances For
            @[inline]

            The full path to the workspace's Lake directory (e.g., .lake).

            Instances For
              @[inline]

              Whether the Lake artifact cache should be enabled by default for packages in the workspace.

              Instances For
                @[deprecated Lake.Workspace.enableArtifactCache? (since := "2026-02-03")]

                Whether the Lake artifact cache should be enabled by default for packages in the workspace.

                Instances For

                  Whether the Lake artifact cache should is enabled for workspace's root package.

                  Instances For
                    @[reducible, inline, deprecated Lake.Workspace.isRootArtifactCacheWritable (since := "2026-02-03")]

                    Whether the Lake artifact cache should is enabled for workspace's root package.

                    Instances For
                      @[inline]

                      Returns the cache service used by default for downloads (e.g., for lake cache get).

                      This is configured through cache.defaultService in the system Lake configuration. If unconfigured, Lake defaults to using Reservoir.

                      Instances For
                        @[inline]

                        Returns the cache service (if any) used by default for uploads (e.g., for lake cache put).

                        This is configured through cache.defaultUploadService in the system Lake configuration.

                        Instances For
                          @[inline]

                          Returns the configured cache service with the given name.

                          This is configured through cache.service entries in the global Lake configuration.

                          Instances For
                            @[inline]

                            The path to the workspace's remote packages directory relative to dir.

                            Instances For
                              @[inline]

                              The workspace's dir joined with its relPkgsDir.

                              Instances For
                                @[inline]

                                Arguments to pass to lean for files outside a library (e.g., via lake lean).

                                Instances For
                                  @[inline]

                                  Options to pass to lean for files outside a library (e.g., via lake lean).

                                  Instances For
                                    @[inline]

                                    Options to pass to the Lean server when editing Lean files outside a library.

                                    Instances For
                                      @[inline]

                                      Returns the names of the root modules of the workpace root's default targets.

                                      Instances For
                                        @[inline]

                                        The workspace's Lake manifest.

                                        Instances For
                                          @[inline]

                                          The path to the workspace file used to configure automatic package overloads.

                                          Instances For

                                            Add a package to the workspace.

                                            Instances For
                                              @[inline]

                                              Returns the unique package in the workspace (if any) that is identified by keyName.

                                              Instances For
                                                @[inline]

                                                Returns the first package in the workspace (if any) that has been assigned the name.

                                                This can be used to find the package corresponding to a user-provided name. If the package's unique identifier is already available, use findPackageByKey? instead.

                                                Instances For
                                                  @[reducible, inline, deprecated "Use `findPackageByKey?` or `findPackageByName?` instead" (since := "2025-12-03")]

                                                  Deprecated. If attempting to find the package corresponding to a user-provided name, use findPackageByName?. Otherwise, if the package's unique identifier is available, use findPackageByKey?.

                                                  Instances For

                                                    Try to find a script in the workspace with the given name.

                                                    Instances For

                                                      Check if the module is local to any package in the workspace.

                                                      Instances For

                                                        Check if the module is buildable by any package in the workspace.

                                                        Instances For

                                                          Locate the named, buildable, importable, local module in the workspace.

                                                          Instances For

                                                            For each package in the workspace, locate the named, buildable, importable, local module.

                                                            Instances For

                                                              Locate the named, buildable, but not necessarily importable, module in the workspace.

                                                              Instances For

                                                                Returns the buildable module in the workspace whose source file is path.

                                                                Instances For

                                                                  Try to find a Lean library in the workspace with the given name.

                                                                  Instances For

                                                                    Try to find a Lean executable in the workspace with the given name.

                                                                    Instances For

                                                                      Try to find an external library in the workspace with the given name.

                                                                      Instances For

                                                                        Try to find a target configuration in the workspace with the given name.

                                                                        Instances For

                                                                          Try to find a target declaration in the workspace with the given name.

                                                                          Instances For

                                                                            Add a facet to the workspace.

                                                                            Instances For

                                                                              Try to find a facet configuration in the workspace with the given name.

                                                                              Instances For

                                                                                Add a module facet to the workspace.

                                                                                Instances For

                                                                                  Try to find a module facet configuration in the workspace with the given name.

                                                                                  Instances For

                                                                                    Add a package facet to the workspace.

                                                                                    Instances For

                                                                                      Try to find a package facet configuration in the workspace with the given name.

                                                                                      Instances For

                                                                                        Add a library facet to the workspace.

                                                                                        Instances For

                                                                                          Try to find a library facet configuration in the workspace with the given name.

                                                                                          Instances For

                                                                                            The workspace's binary directories (which are added to PATH).

                                                                                            Instances For

                                                                                              The workspace's Lean library directories (which are added to LEAN_PATH).

                                                                                              Instances For

                                                                                                The workspace's source directories (which are added to LEAN_SRC_PATH).

                                                                                                Instances For

                                                                                                  The workspace's shared library path (e.g., for --load-dynlib). This is added to the sharedLibPathEnvVar by lake env.

                                                                                                  Instances For

                                                                                                    The augmented PATH of the workspace environment.

                                                                                                    This prepends the detected self.lakeEnv.path of the system environment with the workspace's binPath. On Windows, it also adds the workspace's sharedLibPath.

                                                                                                    Instances For

                                                                                                      The detected LEAN_PATH of the environment augmented with the workspace's leanPath and Lake's libDir.

                                                                                                      Instances For

                                                                                                        The detected LEAN_SRC_PATH of the environment augmented with the workspace's leanSrcPath and Lake's srcDir.

                                                                                                        Instances For

                                                                                                          The detected environment augmented with Lake's and the workspace's configuration. These are the settings use by lake env / Lake.env to run executables.

                                                                                                          Instances For

                                                                                                            Remove all packages' build outputs (i.e., delete their build directories).

                                                                                                            Instances For