Closed aleeusgr closed 1 year ago
https://input-output-hk.github.io/haskell.nix/dev/installing-nix-tools.html https://input-output-hk.github.io/haskell.nix/tutorials/getting-started
nix-build -A example-validator
trace: WARNING: No sha256 found for source-repository-package https://github.com/input-output-hk/plutus-apps ref=v1.0.0-alpha1 rev=(unspecified) download may fail in restricted mode (hydra) fatal: couldn't find remote ref refs/heads/v1.0.0-alpha1 error: program 'git' failed with exit code 128
niv add input-output-hk/plutus-apps -n plutus-apps
trace: WARNING: No sha256 found for source-repository-package https://github.com/input-output-hk/cardano-wallet ref=(unspecified) rev=18a931648550246695c790578d4a55ee2f10463e download may fail in restricted mode (hydra) error: fetchTree argument 'ref' is null while a string, Boolean or integer is expected (use '--show-trace' to show detailed location information)
Theory:
I need to update tag
in project.cabal, e.g. https://github.com/SIDANWhatever/plutus-cborhex-automation/blob/0cab0e61e235b168209e558aa950f652ce1f7cc0/example-validator/cabal.project#L103
Hypothesis:
Nix will A(crash in next phase) or B(build)
Test:
keep updating tags cabal.project
, branch nix
[alex@nixos:~/workshop]$ nix-prefetch-github input-output-hk servant-purescript
{ "owner": "input-output-hk", "repo": "servant-purescript", "rev": "4a77cd089130eb9fb71f98294c466f2519553db6", "sha256": "LrIbMa+PLZcyxCGZ6ZI2B5LFe3z6m53RSdjQm3wurc4=", "fetchSubmodules": false, "leaveDotGit": false, "deepClone": false }
niv add input-output-hk/servant-purescript
niv update
./nix/sources.json: "servant-purescript": {
1 "branch": "master",
2 "description": "Translate servant API to purescript code, with the help of purescript-bridge.",
3 "homepage": null,
4 "owner": "input-output-hk",
5 "repo": "servant-purescript",
6 "rev":
7 "rev": "4a77cd089130eb9fb71f98294c466f2519553db6",
8 "sha256": "1kmd5ry9pl6q978rv6zsgixwb4h76s9fk691qhr9fbcgmwqipcif",
9 "type": "tarball",
10 "url": "https://github.com/input-output-hk/servant-purescript/archive/4a77cd089130eb9fb71f98294c466f2519553 db6.tar.gz",
11 "url_template": "https://github.com// /archive/ .tar.gz"
12 }
cabal.project
source-repository-package
4 type: git
3 location: https://github.com/input-output-hk/servant-purescript
2 --from ??
1 tag: 44e7cacf109f84984cd99cd3faf185d161826963 -- from ??
2 --tag: 3a7f069ccc491c783a28429aa8bcb504f70dc62b
I should test tag pairs for cabal.project
in nix/sources.json
Well, that is the famous nix annoying problem. Basically, you just put an empty string for the sha256 and nix will calculate it for you and print out in the error message.
testing https://input-output-hk.github.io/haskell.nix/tutorials/source-repository-hashes.html
added sha256, nix-build
returns
++ HOME=/nix/store/986l9h9bh329705a0i98207hvmf2fbrd-tarballRepo_hackage.haskell.org-at-2022-05-18T000000Z ++ cabal new-update hackage.haskell.org-at-2022-05-18T000000Z
error: hash mismatch in fixed-output derivation '/nix/store/ql1hmll3lgr287inhhj503rsd3mmfryf-cardano-addresses-b7273a5.drv': specified: sha256-Hesb5GXSx0IwKSIi42ofisVELcQNX6lwHcoZcbaDiqc= got: sha256-91F9+ckA3lBCE4dAVLDnMSpwRLa7zRUEEBYEHv0sOYk= error: 1 dependencies of derivation '/nix/store/1bj2nds4ss6iaynwbap1w713f69njkw8-source-repository-package.drv' failed to build error: 1 dependencies of derivation '/nix/store/pjh0q4clprp9z2sjqf2jgbw0321v3dic-haskell-project-plan-to-nix-pkgs.drv' failed to build
hash got copied wrong
Error: cabal: Could not resolve dependencies: [0] trying: Win32-network-0.1.0.0 (user goal) [1] trying: base-4.16.3.0/installed-4.16.3.0 (dependency of Win32-network) [2] next goal: byron-spec-chain (user goal) [2] rejecting: byron-spec-chain-0.1.0.0 (conflict: base==4.16.3.0/installed-4.16.3.0, byron-spec-chain => base>=4.12 && <4.15) [__2] fail (backjumping, conflict set: base, byron-spec-chain) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: base, byron-spec-chain, Win32-network
error: builder for '/nix/store/nv9fxkfnlyk8q09xxgygv3v4gpnz8b67-haskell-project-plan-to-nix-pkgs.drv' failed with exit code 1; last 10 log lines: Error: cabal: Could not resolve dependencies: [0] trying: Win32-network-0.1.0.0 (user goal) [1] trying: base-4.16.3.0/installed-4.16.3.0 (dependency of Win32-network) [2] next goal: byron-spec-chain (user goal) [2] rejecting: byron-spec-chain-0.1.0.0 (conflict: base==4.16.3.0/installed-4.16.3.0, byron-spec-chain => base>=4.12 && <4.15) [__2] fail (backjumping, conflict set: base, byron-spec-chain) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: base, byron-spec-chain, Win32-network
For full logs, run 'nix log /nix/store/nv9fxkfnlyk8q09xxgygv3v4gpnz8b67-haskell-project-plan-to-nix-pkgs.drv'. (use '--show-trace' to show detailed location information)
compiler-nix-name = "ghc8107";
in default.nixError: Setup: Duplicate modules in library: Moo.GeneticAlgorithm.Crossover
error: builder for '/nix/store/062fz0mbm1nbslp4kz6j0ina86fsiabn-moo-lib-moo-1.2.drv' failed with exit code 1;
error: 1 dependencies of derivation '/nix/store/2d3i05dw6z6hwcsx0gcnfn1wzdibh3gz-goblins-lib-goblins-0.2.0.0-config.drv ' failed to build
-- Should follow cardano-wallet.
3 source-repository-package
2 type: git
1 location: https://github.com/input-output-hk/goblins
292 --sha256: z9ut0y6umDIjJIRjz9KSvKgotuw06/S8QDwOtVdGiJ0=
1 tag: cde90a2b27f79187ca8310b6549331e59595e7ba
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the bug I need to create nix infrastructure for my project. The final goal is a docker container that exposes an API endpoint.
below
x86_64-linux
3a7f069ccc491c783a28429aa8bcb504f70dc62b
Steps To Reproduce
Steps for reproducing (try to minimise the size of the code base if possible).
git clone git@github.com:SIDANWhatever/plutus-cborhex-automation.git
cd plutus-cborhex-automation/example-validator
niv init
niv add input-output-hk/haskell.nix -n haskellNix
niv update haskellNix
❌nix-build -A example-validator.components.exes.example-validator
fix errors by adding --sha256 incabal.project
Expected behavior
docker load < $(nix-build docker.nix)
exit code 0Additional context the project is a Plutus rest API endpoint. I need to build a docker container for it.