diff --git a/.buildkite/nightly.yml b/.buildkite/nightly.yml index 4fa1c8db907..5a6a904ac22 100644 --- a/.buildkite/nightly.yml +++ b/.buildkite/nightly.yml @@ -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 diff --git a/.editorconfig b/.editorconfig index 43a59deee8c..4f51bd532c3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.gitattributes b/.gitattributes index 0efc6338638..75ce5ec3515 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/cabal.project b/cabal.project index 591b5c94689..82122c56ace 100644 --- a/cabal.project +++ b/cabal.project @@ -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 diff --git a/docs/contributing/Nix.md b/docs/contributing/Nix.md index c992bf89e63..6acd1594ad9 100644 --- a/docs/contributing/Nix.md +++ b/docs/contributing/Nix.md @@ -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. @@ -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. diff --git a/docs/contributing/Notes-from-upgrading-GHC-version.md b/docs/contributing/Notes-from-upgrading-GHC-version.md index 26306ed261d..ddc3bcad548 100644 --- a/docs/contributing/Notes-from-upgrading-GHC-version.md +++ b/docs/contributing/Notes-from-upgrading-GHC-version.md @@ -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: @@ -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. diff --git a/docs/contributing/Testing.md b/docs/contributing/Testing.md index 76dc4854364..67322d43e82 100644 --- a/docs/contributing/Testing.md +++ b/docs/contributing/Testing.md @@ -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 diff --git a/docs/contributing/Updating-Dependencies.md b/docs/contributing/Updating-Dependencies.md index a32b4fd5fe1..c4094ce17e1 100644 --- a/docs/contributing/Updating-Dependencies.md +++ b/docs/contributing/Updating-Dependencies.md @@ -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 @@ -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 diff --git a/docs/developers/Building.md b/docs/developers/Building.md index 16c62037adb..d9af658afa2 100644 --- a/docs/developers/Building.md +++ b/docs/developers/Building.md @@ -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: diff --git a/flake.nix b/flake.nix index 3f64496fcb1..5ebad7707fb 100644 --- a/flake.nix +++ b/flake.nix @@ -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 - # - 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 ]; @@ -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 { diff --git a/hie-direnv.yaml b/hie-direnv.yaml index 2d6b1a60674..b754255e2a1 100644 --- a/hie-direnv.yaml +++ b/hie-direnv.yaml @@ -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. diff --git a/lib/wallet/src/Cardano/Wallet/Version.hs b/lib/wallet/src/Cardano/Wallet/Version.hs index 4adf3b8f681..2c0eec55e2d 100644 --- a/lib/wallet/src/Cardano/Wallet/Version.hs +++ b/lib/wallet/src/Cardano/Wallet/Version.hs @@ -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 diff --git a/nix/config.nix b/nix/config.nix index 4973d263772..9bf0ca4e02b 100644 --- a/nix/config.nix +++ b/nix/config.nix @@ -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; diff --git a/nix/haskell.nix b/nix/haskell.nix index 2cd52607f3b..c178541f45d 100644 --- a/nix/haskell.nix +++ b/nix/haskell.nix @@ -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 { diff --git a/nix/migration-tests.nix b/nix/migration-tests.nix index 31e2198e042..ecc28b9ac89 100644 --- a/nix/migration-tests.nix +++ b/nix/migration-tests.nix @@ -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 ... # ############################################################################ diff --git a/nix/overlays/common-lib.nix b/nix/overlays/common-lib.nix index 3667881bf6c..53fd8f9984c 100644 --- a/nix/overlays/common-lib.nix +++ b/nix/overlays/common-lib.nix @@ -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 diff --git a/nix/stack-shell.nix b/nix/stack-shell.nix deleted file mode 100644 index 27feb118852..00000000000 --- a/nix/stack-shell.nix +++ /dev/null @@ -1 +0,0 @@ -{ extraArgs ? [], stackExtraArgs ? extraArgs, ...}@args: (import ./flake-compat.nix args).shellNix.stack diff --git a/nix/stack2cabal.nix b/nix/stack2cabal.nix deleted file mode 100644 index 102b5a41947..00000000000 --- a/nix/stack2cabal.nix +++ /dev/null @@ -1,18 +0,0 @@ -# Builds stack2cabal and makes a script to run it using the latest -# Hackage index-state known to the current revision of Haskell.nix. - -{ pkgs ? import ./default.nix {} }: - -let - index-state-hashes = import pkgs.haskell-nix.indexStateHashesPath; - latest-haskell-nix-index-state = pkgs.lib.last (builtins.attrNames index-state-hashes); - # Doesn't build with ghc-8.6.5 - stack2cabal = pkgs.haskell-nix.tool "ghc884" "stack2cabal" { - version = "1.0.12"; - index-state = latest-haskell-nix-index-state; - }; -in - pkgs.writeScript "run-stack2cabal" '' - #!${pkgs.runtimeShell} - exec ${stack2cabal}/bin/stack2cabal -p ${latest-haskell-nix-index-state} "$@" - ''