Skip to content

Fix index-state syntax #3700

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

Merged
merged 4 commits into from
Feb 22, 2023
Merged

Conversation

andreabedini
Copy link
Contributor

The second index-state stanza completely ovverides the first, resetting hackage index state to HEAD. See haskell/cabal#8568

  • I have ...

Comments

Issue Number

@paolino
Copy link
Collaborator

paolino commented Jan 21, 2023

Hi I'm trying your patch.

[paolino@nixos:~/iohk/cardano-wallet]$ nix/regenerate.sh 
No changes needed to cabal.project
warning: Git tree '/home/paolino/iohk/cardano-wallet' is dirty
error: attribute 'index-state' already defined at /nix/store/8349dd2kfqgr4n49c66a01yc08wmv39d-cabal-project-index-state.nix:2:3

       at /nix/store/8349dd2kfqgr4n49c66a01yc08wmv39d-cabal-project-index-state.nix:3:3:

            2|   index-state = "2022-09-27T00:00:00Z";
            3|   index-state = "";
             |   ^
            4|   with-compiler = "ghc-8.10.7";
(use '--show-trace' to show detailed location information)

@paolino
Copy link
Collaborator

paolino commented Jan 21, 2023

@piotr-iohk , regarding the actual failure in the gh CI. I think it breaks because check-scope is trying to fetch from origin . Is this the wanted behavior?

@Anviking
Copy link
Member

@andreabedini
Copy link
Contributor Author

andreabedini commented Jan 24, 2023

oh right, I didn't see you had custom nix code. What are you trying to achieve there? from what I can see you are trying to parse the index-state and the compiler name from cabal.project and pass it to hackage-package to build other tools of which you specify the version. Since this is nix-land, you could just skip the parsing and passing of the index-state, since haskell.nix will provide a fixed index state anyway (through hackage.nix, which you can bump independently of haskell.nix).

@jonathanknowles
Copy link
Contributor

I can confirm that this branch works for me.

After switching to the branch, I can:

  • successfully enter a nix develop shell
  • successfully build everything with cabal build all
  • successfully use HLS

@andreabedini many thanks for doing this work! 🙏🏻

@jonathanknowles jonathanknowles self-requested a review February 16, 2023 06:11
@jonathanknowles
Copy link
Contributor

bors try

iohk-bors bot added a commit that referenced this pull request Feb 16, 2023
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 16, 2023

try

Build failed:

The second index-state stanza completely ovverides the first, resetting hackage index state to HEAD. See haskell/cabal#8568
- leave building tool to haskell.nix
- remove with-compiler from cabal.project to allow both 8107 and 925
- remove materialized plans and tooling around it
- partially update documentation
@andreabedini
Copy link
Contributor Author

Ah right, the failure is because there's no ./nix/regenerate.sh anymore :D

@andreabedini
Copy link
Contributor Author

I just noticed this part in nix/haskell.nix

      # The list of project packages is not automatically discovered yet,
      # instead it is generated by ./nix/regenerate.sh
      projectPackages = import ./project-package-list.nix;
# ...
      modules =
        let inherit (config) src coverage profiling;
        in
        [
          {
            packages = lib.genAttrs projectPackages (name: {
              # Mark package as local non-dep in the nix-shell.
              # fixme: Haskell.nix should set it
              package.isProject = true;

              # Enable release flag (optimization and -Werror)
              flags.release = true;
# ...

not sure what to do here

@Anviking
Copy link
Member

Anviking commented Feb 16, 2023

We can drop the following lines from nix/regenerate.sh

# Regenerate materialized haskell-build-tools in ./materialized
nix build .#buildToolsGenerateMaterialized
. ./result/bin/regenerate-materialized-nix

# Regenerate materialized iohk-nix-utils in ./materialized
 nix build .#iohkNixGenerateMaterialized
./result/bin/regenerate-materialized-nix

which should make the CI check happy.

But I'm getting this error from direnv reload locally:

error: undefined variable 'iohk-nix-utils'

       at /nix/store/8rkfydldy0cjzxpyvz0dngv5idvr48fm-source/nix/haskell.nix:60:73:

           59|       rewriteLibsPostInstall = lib.optionalString (pkgs.stdenv.hostPlatform.isDarwin) ''
           60|         export PATH=$PATH:${lib.makeBinPath (with pkgs.buildPackages; [ iohk-nix-utils binutils nix ])}
             |                                                                         ^
           61|         rewrite-libs $out/bin $out/bin/*
(use '--show-trace' to show detailed location information)
warning: ignoring untrusted substituter 'https://hydra.iohk.io'
warning: ignoring untrusted substituter 'https://ghcide-nix.cachix.org'
warning: ignoring untrusted substituter 'https://all-hies.cachix.org'
direnv: renewed cache
direnv: export +XDG_DATA_DIRS

It seems the iohk-nix-utils was lost here with the deletion of build-tools.nix and I guess we should move it to somewhere else to preserve it, but not sure myself how to do that.

@andreabedini
Copy link
Contributor Author

iohk-nix-utils only got renamed, I thought I changed all the occurrence but I must have missed some. I will look into it tomorrow 👍

@Anviking
Copy link
Member

bors try

iohk-bors bot added a commit that referenced this pull request Feb 17, 2023
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 17, 2023

try

Build failed:

@Anviking
Copy link
Member

@andreabedini there's this remaining problem now on windows, set-git-rev: No such file or directory, do you know how to fix? 🙏

error: builder for '/nix/store/dgknvfr5mrzw35bprqv14j2d3ip8pkwj-cardano-cli-exe-cardano-cli-x86_64-w64-mingw32-1.35.4.drv' failed with exit code 127;
--
  | last 10 log lines:
  | > Building executable 'cardano-cli' for cardano-cli-1.35.4..
  | > [1 of 1] Compiling Main             ( app/cardano-cli.hs, dist/build/cardano-cli/cardano-cli-tmp/Main.o )
  | > Linking dist/build/cardano-cli/cardano-cli.exe ...
  | > installing
  | > Installing executable cardano-cli in /nix/store/w5iffnj5h0b1vnnw39m667gcq4mb5acn-cardano-cli-exe-cardano-cli-x86_64-w64-mingw32-1.35.4/bin
  | > Warning: The directory
  | > /nix/store/w5iffnj5h0b1vnnw39m667gcq4mb5acn-cardano-cli-exe-cardano-cli-x86_64-w64-mingw32-1.35.4/bin
  | > is not in the system search path.
  | > Symlink libffi and gmp .dlls ...
  | > /nix/store/ji83rcl8f6wlsh082sflack5qr5qrp2c-stdenv-linux/setup: line 89: /nix/store/jchrw4wd0x7258i6hdwxzklc522dfr2w-iohk-nix-utils/bin/set-git-rev: No such file or directory
  | For full logs, run 'nix log /nix/store/dgknvfr5mrzw35bprqv14j2d3ip8pkwj-cardano-cli-exe-cardano-cli-x86_64-w64-mingw32-1.35.4.drv'.
  | error: 1 dependencies of derivation '/nix/store/k371m9bgc32yx5g7h7pjqn73nsf54lca-cardano-wallet-v2022-12-14-win64.drv' failed to build


@andreabedini
Copy link
Contributor Author

@Anviking I am aware but I haven't figure it out yet :-)

@andreabedini
Copy link
Contributor Author

bors try

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 21, 2023

🔒 Permission denied

Existing reviewers: click here to make andreabedini a reviewer

@jonathanknowles
Copy link
Contributor

bors try

iohk-bors bot added a commit that referenced this pull request Feb 21, 2023
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 21, 2023

try

Build succeeded:

@Anviking
Copy link
Member

bors try

iohk-bors bot added a commit that referenced this pull request Feb 21, 2023
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 21, 2023

try

Build succeeded:

Copy link
Contributor

@HeinrichApfelmus HeinrichApfelmus left a comment

Choose a reason for hiding this comment

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

Thank you! 😊

I can find no obvious defects. The following continue to work for me:

  • nix develop
  • hoogle
  • ghci (after ./scripts/gen-ghci.sh as usual)

Copy link
Member

@Anviking Anviking left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

It seems we've lost haskell-language-server-wrapper, so I had to repoint my editor LSP config to haskell-language-server, but not sure what the conventional approach is / if we care enough to re-add it or not.

@andreabedini
Copy link
Contributor Author

andreabedini commented Feb 22, 2023

@Anviking I don't think there's anything I can do re haskell-language-server-wrapper. Dev shells in other repos seems to only offer the haskell-language-server binary.

@Anviking
Copy link
Member

Anviking commented Feb 22, 2023

I was going to say the plutus repo was the one other repo I could find with it, but it's not present on master anymore. To me it does seem useful to provide the wrapper for people whose editors are set up to look for it, to ensure the correct (nix-provided) HLS version is selected automatically… 🤔 but, then why are other iohk repos not doing this? 🤷‍♂️ Anyway, this is a not that important detail, and we can re-add it later if we see fit. Thanks again for this work!

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Feb 22, 2023

Build succeeded:

@iohk-bors iohk-bors bot merged commit 6dca83f into cardano-foundation:master Feb 22, 2023
WilliamKingNoel-Bot pushed a commit that referenced this pull request Feb 22, 2023
…ini The second index-state stanza completely ovverides the first, resetting hackage index state to HEAD. See haskell/cabal#8568
 
 
 <!--
 Detail in a few bullet points the work accomplished in this PR.
 
 Before you submit, don't forget to:
 
 CODE-OF-CONDUCT.md LICENSE README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Make sure the GitHub PR fields are correct:
 ✓ Set a good Title for your PR.
 ✓ Assign yourself to the PR.
 ✓ Assign one or more reviewer(s).
 ✓ Link to a Jira issue, and/or other GitHub issues or PRs.
 ✓ In the PR description delete any empty sections
 and all text commented in <!--, so that this text does not appear
 in merge commit messages.
 
 CODE-OF-CONDUCT.md LICENSE README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Don't waste reviewers' time:
 ✓ If it's a draft, select the Create Draft PR option.
 ✓ Self-review your changes to make sure nothing unexpected slipped through.
 
 CODE-OF-CONDUCT.md LICENSE README.md bors.toml cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json hie-direnv.yaml lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Try to make your intent clear:
 ✓ Write a good Description that explains what this PR is meant to do.
 ✓ Jira will detect and link to this PR once created, but you can also
 link this PR in the description of the corresponding Jira ticket.
 ✓ Highlight what Testing you have done.
 ✓ Acknowledge any changes required to the Documentation.
 -->
 
 
 - [ ] I have ...
 
 ### Comments
 
 <!-- Additional comments, links, or screenshots to attach, if any. -->
 
 ### Issue Number
 
 <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles.
 Note: Jira issues of the form ADP- will be auto-linked. -->
 Co-authored-by: Andrea Bedini <[email protected]> Source commit: 6dca83f
@andreabedini andreabedini deleted the patch-2 branch February 22, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants