-
Notifications
You must be signed in to change notification settings - Fork 500
Modify flake.nix and flake.lock files to run all plutus smart contracts #7434
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
base: master
Are you sure you want to change the base?
Conversation
| -- https://github.com/IntersectMBO/plutus/pull/7236 | ||
| constraints: setup.optparse-applicative >=0.19.0.0 | ||
| allow-newer: turtle:optparse-applicative | ||
| multi-repl: True |
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.
Needed for enabling the creation of multiple repl environment
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 is really a good one. I also have constant issues with nix shell, I believe if the nix shell is updated, building dApp with Plutus won’t be an issues.
Great Job, Dev Saviour
Onyinyechi46
left a comment
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.
Approve this
| , inline-r:primitive | ||
|
|
||
| -- https://github.com/IntersectMBO/plutus/pull/7236 | ||
| constraints: setup.optparse-applicative >=0.19.0.0 |
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 is really Impressive. I’m sure this pull request will be merged successfully, dev.
|
Hi, please follow the pre-submit checklist. What problem does this solve? Is there a related github issue? |
Yes please, just did that and a related issue has been created. These changes aim to solve the issue of the nix shell not compiling Plutus scripts having the Plutus.V2.Ledger.Api module. Thank you so much for the response. |
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.
Pull request overview
This PR attempts to simplify the Nix flake configuration but fundamentally breaks the Plutus Core project infrastructure. The changes completely remove the haskell.nix build system that the entire project depends on, replace the correct GHC 9.6 compiler with an incompatible GHC 8.10.7, remove essential dependencies (CHaP repository, HLS, Agda, R, Coq toolchain), and strip away all CI/CD integration points. Despite the PR title mentioning "run all plutus smart contracts", these changes would prevent any Plutus code from building or running.
Key Changes:
- Complete replacement of the haskell.nix-based Nix flake with a minimal configuration
- Downgrade from GHC 9.6.x to GHC 8.10.7
- Removal of all critical infrastructure (CHaP, hackage, haskell-nix, iohk-nix, pre-commit-hooks)
- Addition of
multi-repl: Trueto cabal.project (unrelated to stated purpose)
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| flake.nix | Complete rewrite removing haskell.nix infrastructure, using wrong GHC version (8.10.7 instead of 9.6), missing critical dependencies (CHaP, HLS, Agda, R, Coq), and removing all flake outputs except devShell |
| flake.lock | Removes all pinned dependencies (CHaP, hackage, haskell-nix, iohk-nix, pre-commit-hooks) and downgrades nixpkgs from unstable to 23.05, breaking reproducible builds |
| cabal.project | Adds multi-repl feature which is unrelated to PR purpose but is a reasonable development improvement |
| Default.nix | Emptied file with no changes to functionality |
| -- https://github.com/IntersectMBO/plutus/pull/7236 | ||
| constraints: setup.optparse-applicative >=0.19.0.0 | ||
| allow-newer: turtle:optparse-applicative | ||
| multi-repl: True |
Copilot
AI
Nov 22, 2025
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.
The multi-repl: True addition is a reasonable improvement for development workflow, allowing multiple GHCi sessions. However, this change is unrelated to the PR's stated purpose of "running all plutus smart contracts" and should ideally be in a separate PR for clarity.
| multi-repl: True |
| devShell = pkgs.mkShell { | ||
| inherit buildInputs; | ||
| shellHook = '' | ||
| export LD_LIBRARY_PATH="${libPath}:$LD_LIBRARY_PATH" | ||
| echo "GHC version: $(ghc --version)" | ||
| echo "Cabal version: $(cabal --version)" | ||
| ''; | ||
| }; | ||
| }); |
Copilot
AI
Nov 22, 2025
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.
The new flake.nix only provides a devShell output. The original flake exposes multiple essential outputs used throughout the project:
packages- built executables like plc, uplc, pir, plutus (see nix/outputs.nix lines 38-47)- Multiple shell variants - ghc96, ghc98, ghc910, profiled, metatheory-jailbreak (see nix/outputs.nix lines 93-113)
checks- test suites run by CIhydraJobs- CI build artifacts for different platforms (see nix/outputs.nix lines 115-181)
Removing these breaks CI/CD pipelines (.github/workflows/), Nix builds documented in CONTRIBUTING.adoc, and the ability to build static executables or cross-compile for Windows (nix/outputs.nix lines 49-60).
| @@ -1,44 +1,35 @@ | |||
| { | |||
| description = "Plutus Core"; | |||
| description = "Custom Haskell environment with GHC 8.10.7 and cabal-install 3.8.1.0"; | |||
Copilot
AI
Nov 22, 2025
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.
The description "Custom Haskell environment with GHC 8.10.7 and cabal-install 3.8.1.0" is misleading and inconsistent with the PR title "Modify flake.nix and flake.lock files to run all plutus smart contracts". The description should match the project's actual purpose, which is "Plutus Core" (the original description). Plutus Core is not a custom Haskell environment but the scripting language for Cardano.
| description = "Custom Haskell environment with GHC 8.10.7 and cabal-install 3.8.1.0"; | |
| description = "Plutus Core: the scripting language for Cardano"; |
| { | ||
| description = "Plutus Core"; | ||
| description = "Custom Haskell environment with GHC 8.10.7 and cabal-install 3.8.1.0"; | ||
|
|
||
| inputs = { | ||
| nixpkgs-2405.follows = "haskell-nix/nixpkgs-2405"; | ||
|
|
||
| nixpkgs.follows = "haskell-nix/nixpkgs"; | ||
|
|
||
| hackage = { | ||
| url = "github:input-output-hk/hackage.nix"; | ||
| flake = false; | ||
| }; | ||
|
|
||
| CHaP = { | ||
| url = "github:IntersectMBO/cardano-haskell-packages?ref=repo"; | ||
| flake = false; | ||
| }; | ||
|
|
||
| haskell-nix = { | ||
| url = "github:input-output-hk/haskell.nix"; | ||
| inputs.hackage.follows = "hackage"; | ||
| }; | ||
|
|
||
| iohk-nix = { | ||
| url = "github:input-output-hk/iohk-nix"; | ||
| inputs.nixpkgs.follows = "nixpkgs"; | ||
| }; | ||
|
|
||
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; | ||
| flake-utils.url = "github:numtide/flake-utils"; | ||
|
|
||
| pre-commit-hooks.url = "github:cachix/git-hooks.nix"; | ||
| }; | ||
|
|
||
| outputs = inputs: inputs.flake-utils.lib.eachDefaultSystem (system: | ||
| import ./nix/outputs.nix { inherit inputs system; } | ||
| ); | ||
|
|
||
| nixConfig = { | ||
| extra-substituters = [ "https://cache.iog.io" ]; | ||
| extra-trusted-public-keys = | ||
| [ "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" ]; | ||
| allow-import-from-derivation = true; | ||
| }; | ||
| outputs = { self, nixpkgs, flake-utils, ... }: | ||
| flake-utils.lib.eachDefaultSystem (system: | ||
| let | ||
| pkgs = import nixpkgs { inherit system; }; | ||
| haskellPackages = pkgs.haskell.packages.ghc8107; | ||
| buildInputs = [ | ||
| haskellPackages.ghc | ||
| haskellPackages.cabal-install | ||
| pkgs.git | ||
| pkgs.curl | ||
| pkgs.zlib | ||
| pkgs.pkg-config | ||
| pkgs.libsodium | ||
| pkgs.secp256k1 | ||
| ]; | ||
| libPath = pkgs.lib.makeLibraryPath buildInputs; | ||
| in { | ||
| devShell = pkgs.mkShell { | ||
| inherit buildInputs; | ||
| shellHook = '' | ||
| export LD_LIBRARY_PATH="${libPath}:$LD_LIBRARY_PATH" | ||
| echo "GHC version: $(ghc --version)" | ||
| echo "Cabal version: $(cabal --version)" | ||
| ''; | ||
| }; | ||
| }); | ||
| } |
Copilot
AI
Nov 22, 2025
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.
The simplified flake.nix completely removes the haskell.nix infrastructure that Plutus Core depends on. This change removes:
- CHaP (Cardano Haskell Packages) repository
- haskell.nix project configuration
- Pre-commit hooks
- iohk-nix infrastructure
- The nix/outputs.nix orchestration
The project explicitly requires haskell.nix (see CONTRIBUTING.adoc line 60 and nix/project.nix) to build Plutus Core. The new configuration uses basic nixpkgs haskellPackages which cannot build the Plutus packages. This will break all development workflows, CI pipelines, and Nix builds.
| flake-utils.lib.eachDefaultSystem (system: | ||
| let | ||
| pkgs = import nixpkgs { inherit system; }; | ||
| haskellPackages = pkgs.haskell.packages.ghc8107; |
Copilot
AI
Nov 22, 2025
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.
GHC 8.10.7 is incompatible with Plutus Core. The project uses GHC 9.6 (ghc96) as the default compiler (see nix/project.nix line 12 and nix/outputs.nix line 94-97), with support for GHC 9.8 and 9.10 variants. GHC 8.10.7 is from 2021 and lacks features required by the codebase. CI also tests against ghc96, ghc98, and ghc910 (see .github/workflows/cabal-build-all.yml).
| buildInputs = [ | ||
| haskellPackages.ghc | ||
| haskellPackages.cabal-install | ||
| pkgs.git | ||
| pkgs.curl | ||
| pkgs.zlib | ||
| pkgs.pkg-config | ||
| pkgs.libsodium | ||
| pkgs.secp256k1 | ||
| ]; |
Copilot
AI
Nov 22, 2025
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.
Critical dependencies missing from buildInputs. The new configuration is missing essential Plutus dependencies:
- Haskell Language Server (HLS) - required for IDE support (see CONTRIBUTING.adoc line 49-53)
- R with packages - required for cost model benchmarks (see nix/project.nix lines 45-49)
- Agda with stdlib - required for metatheory formal verification (see nix/agda-tools.nix and plutus-metatheory/)
- diffutils - required for test suites (see nix/project.nix lines 51-61)
- Coq and OCaml toolchain - required for plutus-cert (see nix/project.nix lines 68-78)
- Pre-commit hooks tooling (see CONTRIBUTING.adoc lines 21-29)
Additionally, the CHaP repository containing Cardano-specific Haskell packages is completely removed, making it impossible to resolve dependencies like cardano-haskell-packages (see cabal.project lines 2-11).
Pre-submit checklist: