@@ -42,10 +42,11 @@ package will be built against.
42
42
43
43
Finally, Stack is __ isolated__ : it will not make changes outside of specific
44
44
Stack directories. Stack-built files generally go in either the Stack root
45
- directory or ` ./.stack-work ` directories local to each project. The Stack root
46
- directory holds packages belonging to snapshots and any Stack-installed versions
47
- of GHC. Stack will not tamper with any system version of GHC or interfere with
48
- packages installed by other build tools, such as Cabal (the tool).
45
+ directory or ` ./.stack-work ` directories local to each project. The
46
+ [ Stack root] ( stack_root.md ) directory holds packages belonging to snapshots and
47
+ any Stack-installed versions of GHC. Stack will not tamper with any system
48
+ version of GHC or interfere with packages installed by other build tools, such
49
+ as Cabal (the tool).
49
50
50
51
## Downloading and Installation
51
52
@@ -807,7 +808,7 @@ The reason we have this structure is that:
807
808
non-standard content into the shared snapshot database.
808
809
809
810
As you probably guessed, there can be multiple snapshot databases available. See
810
- the contents of the ` snapshots ` directory in the Stack root.
811
+ the contents of the ` snapshots ` directory in the [ Stack root] ( stack_root.md ) .
811
812
812
813
* On Unix-like operating systems, each snapshot is in the last of a sequence of
813
814
three subdirectories named after the platform, a 256-bit hash of the source
@@ -1429,87 +1430,6 @@ configuration. It has no effect on projects at all. Every package you install
1429
1430
with it is put into isolated databases just like everywhere else. The only magic
1430
1431
is that it's the catch-all project whenever you're running Stack somewhere else.
1431
1432
1432
- ## Setting the Stack root location
1433
-
1434
- The Stack root is a directory where Stack stores important files. The location
1435
- and contents of the directory depend on the operating system and/or whether
1436
- Stack is configured to use the XDG Base Directory Specification.
1437
-
1438
- The location of the Stack root can be configured by setting the ` STACK_ROOT `
1439
- environment variable or using Stack's ` --stack-root ` option on the command line.
1440
-
1441
- === "Unix-like"
1442
-
1443
- The Stack root contains snapshot packages; tools such as GHC, in a
1444
- `programs` directory; and Stack's global YAML configuration file
1445
- (`config.yaml`).
1446
-
1447
- The default Stack root is `~/.stack`.
1448
-
1449
- === "Windows"
1450
-
1451
- The Stack root contains snapshot packages; and Stack's global YAML
1452
- configuration file (`config.yaml`). The default location of tools such as
1453
- GHC and MSYS2 is outside of the Stack root.
1454
-
1455
- The default Stack root is `%APPDIR%\stack`.
1456
-
1457
- The default location of tools is `%LOCALAPPDATA%\Programs\stack`.
1458
-
1459
- On Windows, the length of filepaths may be limited (to
1460
- [MAX_PATH](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd)),
1461
- and things can break when this limit is exceeded. Setting a Stack root with
1462
- a short path to its location (for example, `C:\sr`) can help.
1463
-
1464
- === "XDG Base Directory Specification"
1465
-
1466
- On Unix-like operating systems and Windows, Stack can be configured to
1467
- follow the XDG Base Directory Specification if the environment variable
1468
- `STACK_XDG` is set to any non-empty value. However, Stack will ignore that
1469
- configuration if the Stack root location has been set on the command line or
1470
- the `STACK_ROOT` environment variable exists.
1471
-
1472
- If Stack is following the XDG Base Directory Specification, the Stack root
1473
- contains what it would otherwise contain for the operating system, but
1474
- Stack's global YAML configuration file (`config.yaml`) may be located
1475
- elsewhere.
1476
-
1477
- The Stack root is `<XDG_DATA_HOME>/stack`. If the `XDG_DATA_HOME`
1478
- environment variable does not exist, the default is `~/.local/share/stack`
1479
- on Unix-like operating systems and `%APPDIR%\stack` on Windows.
1480
-
1481
- The location of `config.yaml` is `<XDG_CONFIG_HOME>/stack`. If the
1482
- `XDG_CONFIG_HOME` environment variable does not exist, the default is
1483
- `~/.config/stack` on Unix-like operating systems and `%APPDIR%\stack` on
1484
- Windows.
1485
-
1486
- This approach treats:
1487
-
1488
- * the project-level YAML configuration file that is common to all projects
1489
- without another such file in their project directory or its ancestor
1490
- directories as _data_ rather than as part of Stack's own
1491
- _configuration_;
1492
-
1493
- * the snapshots database as essential data rather than as non-essential
1494
- data that would be part of a _cache_, notwithstanding that Stack will
1495
- rebuild that database as its contents are needed; and
1496
-
1497
- * the Pantry store as essential data rather than as non-essential data
1498
- that would be part of a _cache_, notwithstanding that Stack will
1499
- download the package index and rebuild the store if it is absent.
1500
-
1501
- The location of the Stack root is reported by command:
1502
-
1503
- ~~~ text
1504
- stack path --stack-root
1505
- ~~~
1506
-
1507
- The full path of Stack's global YAML configuration file is reported by command:
1508
-
1509
- ~~~ text
1510
- stack path --global-config
1511
- ~~~
1512
-
1513
1433
## ` stack.yaml ` versus Cabal files
1514
1434
1515
1435
Now that we've covered a lot of Stack use cases, this quick summary of
0 commit comments