-
Notifications
You must be signed in to change notification settings - Fork 45
Nix flake revamp #4096
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
Nix flake revamp #4096
Conversation
Currently failing because of version constraints in `tasty-test-reporter` dependency `ansi-terminal`. The custom dependencies seem to be ignored.
crypton-x509 = dontCheck hprev.crypton-x509; | ||
data-fix = doJailbreak hprev.data-fix; | ||
decision-diagrams = dontCheck hprev.decision-diagrams; | ||
fgl = dontCheck hprev.fgl; | ||
fgl-arbitrary = dontCheck hprev.fgl-arbitrary; | ||
graphviz = dontCheck hprev.graphviz; | ||
json-rpc = dontCheck hprev.json-rpc; | ||
lifted-base = dontCheck hprev.lifted-base; | ||
prettyprinter = dontCheck hprev.prettyprinter; | ||
semialign = doJailbreak hprev.semialign; | ||
smtlib-backends-process = dontCheck hprev.smtlib-backends-process; | ||
tar = dontCheck hprev.tar; | ||
text-short = doJailbreak hprev.text-short; | ||
these = doJailbreak hprev.these; | ||
ghc-prof = doJailbreak hprev.ghc-prof; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these overrides are definitely required, and I am currently stuck trying to replicate them with some-cabal-hashes.nix
flake.nix
Outdated
# FIXME these two overrides cause an error in some-cabal-hashes.nix | ||
# tasty-test-reporter = | ||
# final.fetchFromGitHub { | ||
# owner = "goodlyrottenapple"; | ||
# repo = "tasty-test-reporter"; | ||
# rev = "b704130545aa3925a8487bd3e92f1dd5ce0512e2"; | ||
# sha256 = "sha256-9CN59Im0BC3vSVhL85v5eXPYYoPbV3NAuv893tXpr/U="; | ||
# }; | ||
# profiteur = | ||
# final.fetchFromGitHub { | ||
# owner = "goodlyrottenapple"; | ||
# repo = "profiteur"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two are custom dependencies from github (forks of repositories that cause dependency issues). The code here follows the some-cabal-hashes
example but is seemingly ignored. I already removed all code that uses tasty-test-reporter
, we can remove the profiteur
consumer, too and forget about this issue.
flake.nix
Outdated
# FIXME likewise, these two `dontCheck` (one inlined) are seemingly ignored. | ||
hfinal.decision-diagrams = hfinal.overrideCabal hprev.decision-diagrams | ||
(drv: { doCheck = false; }); # build runs failing tests | ||
hfinal.json-rpc = final.haskell.packages.dontCheck hprev.json-rpc; # 1.0.4 marked as broken! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dontCheck
setting is somehow also ignored, I keep getting a build failure because of a failing test in decision-diagrams
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be due to the attribute names that are being overridden, here. In this override example, you have to use the haskell package names directly, if I understand correctly. Therefore, currently, the original variants of the packages are being used instead.
# FIXME likewise, these two `dontCheck` (one inlined) are seemingly ignored. | |
hfinal.decision-diagrams = hfinal.overrideCabal hprev.decision-diagrams | |
(drv: { doCheck = false; }); # build runs failing tests | |
hfinal.json-rpc = final.haskell.packages.dontCheck hprev.json-rpc; # 1.0.4 marked as broken! | |
decision-diagrams = hfinal.overrideCabal hprev.decision-diagrams | |
(drv: { doCheck = false; }); | |
json-rpc = hfinal.dontCheck hprev.json-rpc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this earlier, but nix build
(--dry-run
or not) complained about the hfinal.overrideCabal
(or hfinal.dontCheck
) as a missing attribute. Changing that to prev.haskell.lib.{overrideCabal,dontCheck}
worked better 😏 yet still the build is failing on decision-diagrams
(but differently now)
Okay, I checked out the branch and took a closer look at the build. This is the error message: "cabal2nix: user error (*** Found neither a .cabal file nor package.yaml. Exiting.)". Nixpkgs provides only one set of haskell packages per compiler version, with exactly one version of a package each. Also, only one compiler version is usually maintained. A huge percentage of haskell packages is broken, though a broken package can relatively easily be fixed according to documentation. The set of haskell package derivations from stackage is automatically created, see here, in accordance to a stackage.yaml file. The haskell-backend currently instead uses stacklock2nix to create a custom set of haskell packages on the spot, in this case with lts-22.23. The nixpkgs revision currently used instead provides the nixpkgs based set of packages that also instead relies on lts-22.22. While the difference is not large, it still explains why the json-rpc package is broken and marked as broken when not using stacklock2nix. The same is probably going on for the package decision-diagrams. Therefore, both packages derivations, and maybe some of the other dependencies, must be fixed. Again, according to nix documentation this should not be too hard. Also, I took a look at the nixpkgs master and json-rpc is still marked as broken. |
Yes, correct. Which seems rather strange. I tried poking around in the
The configuration also uses a non-standard
Maybe not hard but I have no idea at all how to approach the current issue with |
I continued working on the flake and pushed my progress to this branch. First, I tried to make the build work without some-cabal-hashes. Doing this led me to avoid the previous build error regarding the missing cabal project file. Apparently, this was caused by the way the previous flake used some-cabal-hashes. The overrides attribute of some-cabal-hashes is intended to be used solely to either override the version number of a haskell package or override the package source with a derivation, e.g. fetched via I added the z3 overlay from the original flake and the develop shells still need to be ported over to the new flake. Also, I reverted fixing rv-nix-tools to a specific revision for now. In my opinion, if not specifically required for this pull request, this should be in another pull request. The way we will want to refactor the way nixpkgs is locked in the runtime verification repository should be discussed separately. Currently, hs-backend-booster fails to build due to the wrong version of hashable. The versions of the haskell packages can be found in this nix file. Getting haskell-backend to build successfully will require version overrides, taken from the cabal.project.freeze file. I wonder whether we should parse the freeze file from nix or port the freeze file to nix entirely, and henceforth maintain the version pins in the nix file? I should mention that overriding versions of haskell packages during testing caused an infinite recursion several times. This was caused by overriding packages that are dependencies of cabal2nix, which in turn is used to when overriding a version. I fixed this in the flake by fixing the cabal2nix derivation to an unmodified derivation from the second nixpkgs instance that was in the flake already anyway.
Derivations are built in a temporary directory. Upon failure or success, this directory is deleted. To inspect a failing derivation build, you can pass the flag
I see, fixing the versions should work now with the new commits from my branch.
See above, this should not be broken anymore. |
Thanks for this, I like how it looks now with the several overlay functions! Do you have push access to this repository? (if not we will fix that, you definitely should). Will continue on this path, investigating the |
a4febc8
to
ff7f9cd
Compare
Thank you for giving me write access. I have pushed a new branch that fixed the last two encountered build issues: https://github.com/runtimeverification/haskell-backend/commits/nix-flake-revamp-fixbuild/ I added the missing develop shells, overlays, and the missing prelude-kore output. Also, I adapted the packages output to match the packages output of the previous flake. The previous flake had a default overlay output that included the output of stacklock2nix. We can not provide that output anymore, as any repository that uses the default overlay would be broken and needs to be updated. Though, I quickly glanced at a few repositories and couldn't find any that uses this default overlay! I also find it unlikely anyway. @jberthold Could you please add a commit that updates the documentation regarding stack, cabal, and the updated build system? I already replaced the mentions of stacklock2nix and included some-cabal-hashes. |
When building with cabal in a nix develop shell, cabal rejects the haskell packages provided by nix due to conflicts with the version specified in the freeze file.
I ran CI on the new branch and it failed: https://github.com/runtimeverification/haskell-backend/actions/runs/13856419943 I pushed two new commits to this branch that should fix the issues the CI is running into: https://github.com/runtimeverification/haskell-backend/commits/nix-flake-revamp-fixbuild/ One thing I did was remove the |
CI on the new branch ran successfully this time: https://github.com/runtimeverification/haskell-backend/actions/runs/13858014797 |
Tested with |
Rewriting the
flake.nix
to avoidstacklock2nix
and usesome-cabal-hashes
for faster builds.tasty-test-reporter
andprofiteur
cabal.project.freeze
file is updated to be consistent with thenix
buildstack
LTS-22.23 were checked and are harmless (patch-level only, and all but 3 in test dependencies anyway)