Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADP-2102] Remove mentions of stack from documentation and code #3671

Merged
merged 5 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .buildkite/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ env:
# Per-container variables
SCRATCH_DIR: "/scratch/cardano-wallet"
BUILD_DIR: "/build/cardano-wallet"
STACK_ROOT: "/build/cardano-wallet.stack"
CABAL_DIR: "/build/cardano-wallet.cabal"

# Per-host variables - shared across containers on host
Expand Down
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[stack.yaml]
trim_trailing_whitespace = false

[*.hs]
indent_size = 4
max_line_length = 80
Expand Down
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
# - influence how files are shown in the GitHub diff view
# https://github.com/github/linguist/blob/master/docs/overrides.md

# Hide stuff that is generated by nix-tools stack-to-nix
nix/materialized/stack-nix/*.cache* linguist-generated=true merge=binary
# Hide stuff that is generated by nix-tools
nix/materialized/*/*.nix linguist-generated=true merge=binary

# Hide nix flake lock boilerplate
Expand Down
16 changes: 7 additions & 9 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,26 @@
-- -----------------------------------------------------------------------------
-- Updating this file
--
-- Note that the canonical source of dependencies is stack.yaml and
-- cabal.project should be kept in sync with that. The Nix packages
-- are generated from stack.yaml not cabal.project.
-- This file is the canonical source of dependencies.
-- To generate the Nix packages, use ./nix/regenerate.sh
--
-- -----------------------------------------------------------------------------
-- How to use with the nix-shell
-- How to use with the nix shell
--
-- The advantage of building under nix-shell is that the correct
-- The advantage of building under `nix develop` is that the correct
-- versions of all build and test dependencies are set up for you in the
-- nix-shell environment.
-- nix shell environment.
--
-- Many dependencies, including Haskell package dependencies,
-- are downloaded from an IOG nix cache.
--
-- The Haskell package set in shell.nix is automatically generated
-- from stack.yaml.
-- To build, start `nix develop`, then run `cabal` inside:
--
-- To build, start "nix-shell", then run Cabal inside:
-- nix develop
-- cabal build all -O0
--
-- To build with profiling enabled, use:
--
-- nix develop .#profiled
-- cabal configure --enable-tests --enable-benchmarks --enable-profiling
-- cabal build all
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing/Nix.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Full instructions are on the [[Building#cabalnix-build]] page.

### Code generation

The Nix build depends on code which is generated from `stack.yaml` and
The Nix build depends on code which is generated from
the Cabal files. If you change these files, then you will probably
need to update the generated files.

Expand Down Expand Up @@ -107,5 +107,5 @@ warning: dumping very large path (> 256 MiB); this may run out of memory
Make sure you don't have large files or directories in your git worktree.

When building, Nix will copy the project sources into
`/nix/store`. Standard folders such as `.stack-work` will be filtered
`/nix/store`. Generated folders such as `dist-newstyle` will be filtered
out, but everything else will be copied.
21 changes: 1 addition & 20 deletions docs/contributing/Notes-from-upgrading-GHC-version.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Here is a reference PR that upgrades to GHC 8.10.7: https://github.com/input-output-hk/cardano-wallet/pull/2969

**WARNING**: Updating haskell.nix, the stackage LTS, and/or GHC, changes a lot of the build environment. You should expect to spend time fixing breakages.
**WARNING**: Updating haskell.nix and/or GHC changes a lot of the build environment. You should expect to spend time fixing breakages.

## Process
- Update "with-compiler" in cabal.project:
Expand Down Expand Up @@ -40,25 +40,6 @@ index 28c46f2e4df..6b0778eb5d0 100644
pkgs: super: let
```

- Update compiler in stack.yaml. Update the resolver too if necessary (e.g. to get a newer set of packages):

```diff
diff --git a/stack.yaml b/stack.yaml
index 18b0916933..29f2d6e961 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -13,8 +13,8 @@
#
########################################################################

-resolver: lts-18.5
-compiler: ghc-8.10.5
+resolver: lts-18.13
+compiler: ghc-8.10.7

packages:
- lib/wallet
```
- Update haskell.nix `niv update haskell.nix -b master`.
- Run nix/regenerate.sh.

Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ $ cabal bench cardano-wallet:db

1. Follow the pre-requisites from `integration` above

2. (Optional) Install [hp2pretty](https://www.stackage.org/nightly-2019-03-25/package/hp2pretty-0.9)
2. (Optional) Install [hp2pretty](https://hackage.haskell.org/package/hp2pretty)

```
$ cabal install hp2pretty
Expand Down
22 changes: 5 additions & 17 deletions docs/contributing/Updating-Dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ in a nix cache -- in which case the build result will be downloaded instead.
## nix develop

The default `nix develop` contains build tools, utilities and GHC
configured with a global package-db which matches `stack.yaml`. This
configured with a global package-db which matches `cabal.project`. This
is defined in the `devShell` attribute of `flake.nix`.

## Buildkite
Expand All @@ -28,24 +28,12 @@ build or tests, make sure that it is present there.

### `cardano-node` Haskell dependencies

These are defined by the `resolver` in [`stack.yaml`](https://github.com/input-output-hk/cardano-wallet/blob/master/stack.yaml).

It points to a file in [`cardano-haskell/snapshots`](https://github.com/input-output-hk/cardano-haskell/tree/master/snapshots).

To bump to a new version:

1. Make a copy of the latest snapshot file.
2. Update the dependency revisions to match your chosen version of
`cardano-node/cabal.project`. Refer to `cabal.project` rather than
`stack.yaml` because it is more likely to be correct.
3. Check that `extra-deps` are correct and there are no conflicts with
those in `cardano-wallet`.
4. Run `./nix/regenerate.sh` (or let Buildkite do it)
5. Open a PR on [`cardano-haskell`](https://github.com/input-output-hk/cardano-haskell).
6. Temporarily the snapshot URL in `cardano-wallet/stack.yaml` to
point to the PR branch so that you can test the build.

**Tip**: The `stack.yaml` `resolver` file can also refer to a local file path -- so you needn't necessarily open a PR on `cardano-haskell` to make a temporary change.
1. In `cardano-wallet/cabal.project`, update
the dependency revisions to match your chosen version of
`cardano-node/cabal.project`.
2. Run `./nix/regenerate.sh` (or let Buildkite do it)

### Jörmungandr

Expand Down
6 changes: 0 additions & 6 deletions docs/developers/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ See [`nix/overlays/build-tools.nix`](https://github.com/input-output-hk/cardano-
$ cabal build cardano-wallet:exe:cardano-wallet
```

#### Syncing `stack` and `cabal` dependencies

1. Install [stack2cabal](https://hackage.haskell.org/package/stack2cabal)

2. Run `stack2cabal -p now` to convert the dependencies list from `stack` into a suitable format for `cabal`.

## Nix

Use the [[Nix]] build if:
Expand Down
10 changes: 0 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,6 @@
haskellProject = project;
inherit (config) withCabalCache ghcVersion;
};
stack = cabal.overrideAttrs (old: {
name = "cardano-wallet-stack-env";
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.stack ];
# Build environment setup copied from
# <nixpkgs/pkgs/development/haskell-modules/generic-stack-builder.nix>
STACK_PLATFORM_VARIANT = "nix";
STACK_IN_NIX_SHELL = 1;
STACK_IN_NIX_EXTRA_ARGS = config.stackExtraArgs;
});
docs = pkgs.mkShell {
name = "cardano-wallet-docs";
nativeBuildInputs = [ emanote.packages.${system}.default pkgs.yq ];
Expand Down Expand Up @@ -406,7 +397,6 @@
inherit (config) dockerHubRepoName;
};
inherit (pkgs) checkCabalProject cabalProjectRegenerate;
inherit (project.stack-nix.passthru) generateMaterialized;
buildToolsGenerateMaterialized = pkgs.haskell-build-tools.regenerateMaterialized;
iohkNixGenerateMaterialized = pkgs.iohk-nix-utils.regenerateMaterialized;
} // (lib.optionalAttrs buildPlatform.isLinux {
Expand Down
2 changes: 1 addition & 1 deletion hie-direnv.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
########################################################################
# Custom configuration for haskell-language-server.
#
# Use this instead of the default Stack cradle if you want faster
# Use this instead of the default cradle if you want faster
# reloads and cross-package jump-to-definition.
#
# It requires nix-direnv and your editor must have direnv integration.
Expand Down
3 changes: 0 additions & 3 deletions lib/wallet/src/Cardano/Wallet/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
-- It is assumed that all cardano-wallet packages have the same version, that of
-- the core package.
--
-- Stack builds will have the `git` command available to run during
-- compilation.
--
-- Nix builds will inject the git revision into the executables after
-- compiling. If the git revision has changed but the sources have
-- not, then no haskell packages will be rebuilt, but the embedded git
Expand Down
3 changes: 0 additions & 3 deletions nix/config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ lib: customConfig: let config =
# optional extra haskell.nix module
haskellNix = {};

# optional arguments for stack (nix-shell -A stack --arg stackExtraArgs '[]')
stackExtraArgs = [];

# optional string argument to override compiler, in cabal shell.
ghcVersion = null;

Expand Down
4 changes: 2 additions & 2 deletions nix/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ CHaP: haskell-nix: haskell-nix.cabalProject' [
"$out/bin/$exeName" --fish-completion-script "$exeName" >"$fishCompDir/$exeName.fish"
'';

# It's not automatically discovered from stack-pkgs yet,
# so it's generated by nix/regenerate.sh
# The list of project packages is not automatically discovered yet,
# instead it is generated by ./nix/regenerate.sh
projectPackages = import ./project-package-list.nix;

srcAll = lib.cleanSourceWith {
Expand Down
2 changes: 1 addition & 1 deletion nix/migration-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# individually. For example, run step1 to set up a state directory for
# the old version, then try:
# stateDir=./debug /nix/store/...-launch-migration-test-v2019-12-16.sh step1
# stack exec migration-test -- step2 launch --state-dir=./debug ...
# exec migration-test -- step2 launch --state-dir=./debug ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps:

Suggested change
# exec migration-test -- step2 launch --state-dir=./debug ...
# cabal run migration-test -- step2 launch --state-dir=./debug ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… except that we do not have a migration-test component in any of our .cabal files. 😅 It appears that these tests for database migration have never been ported to the Shelley era and are completely broken.

Fixing the database migration tests is out of scope for this pull request, so I would prefer to write something blatantly wrong rather than try to pretend that the command cabal run migration-test may have worked at some point.

#
############################################################################

Expand Down
4 changes: 2 additions & 2 deletions nix/overlays/common-lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ in {
else null;
};

# Since it's not automatically discovered from stack-pkgs yet, we use homepage as discriminant
# to retrieve local project packages:
# Retrieve the list of local project packages by
# filtering the set of *all* packages by their homepage.
projectPackageList = lib.attrNames (lib.filterAttrs
(_: p: p != null
&& haskellLib.isLocalPackage p.package
Expand Down
1 change: 0 additions & 1 deletion nix/stack-shell.nix

This file was deleted.

18 changes: 0 additions & 18 deletions nix/stack2cabal.nix

This file was deleted.