Skip to content
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

Flake build fails on NixOS #4790

Open
plaidfinch opened this issue Aug 3, 2024 · 0 comments
Open

Flake build fails on NixOS #4790

plaidfinch opened this issue Aug 3, 2024 · 0 comments
Labels
A-tooling Area: developer tooling for building Penumbra itself C-bug Category: a bug

Comments

@plaidfinch
Copy link
Collaborator

Building the flake with nix build .#penumbra fails. Here is the relevant part of the error message:

error: couldn't read crates/view/src/storage/schema.sql: No such file or directory (os error 2)
  --> crates/view/src/storage.rs:58:45
   |
58 |     Lazy::new(|| hex::encode(Sha256::digest(include_str!("storage/schema.sql"))));
   |                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: couldn't read crates/view/src/storage/schema.sql: No such file or directory (os error 2)
   --> crates/view/src/storage.rs:216:30
    |
216 |             tx.execute_batch(include_str!("storage/schema.sql"))?;
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro `include_str` (in Nightly builds, run with -Z macro-backtrace for more info)

error: could not compile `penumbra-view` (lib) due to 2 previous errors

Chasing this error, it becomes apparent that none of the include_str! things in the crate build correctly. However, the Nix formula in https://github.com/starlingcyber/infra/blob/main/packages/penumbra.nix does work. Comparing the two, we see that this repo's flake builds Penumbra like this:

penumbra = (craneLib.buildPackage {
            pname = "penumbra";
            src = cleanSourceWith {
              src = if penumbraRelease == null then craneLib.path ./. else fetchFromGitHub {
                owner = "penumbra-zone";
                repo = "penumbra";
                rev = "v${penumbraRelease.version}";
                sha256 = "${penumbraRelease.sha256}";
              };
              filter = path: type:
                # Retain proving and verification parameters, and no-lfs marker file ...
                (builtins.match ".*\.(no_lfs|param|bin)$" path != null) ||
                # ... as well as all the normal cargo source files:
                (craneLib.filterCargoSources path type);
            };
            nativeBuildInputs = [ pkg-config ];
            buildInputs = if stdenv.hostPlatform.isDarwin then 
              with pkgs.darwin.apple_sdk.frameworks; [clang openssl rocksdb SystemConfiguration CoreServices]
            else
              [clang openssl rocksdb];

            inherit system PKG_CONFIG_PATH LIBCLANG_PATH ROCKSDB_LIB_DIR;
            cargoExtraArgs = "-p pd -p pcli -p pclientd";
            meta = {
              description = "A fully private proof-of-stake network and decentralized exchange for the Cosmos ecosystem";
              homepage = "https://penumbra.zone";
              license = [ licenses.mit licenses.asl20 ];
            };
          }).overrideAttrs (_: { doCheck = false; });

Compared to the formula to build Penumbra in the linked repo, which works:

(craneLib.buildPackage {
  pname = name;
  src = cleanSourceWith {
    src = (fetchgit {
      url = "https://github.com/${owner}/${repo}";
      rev = "v${version}";
      sha256 = hash;
      fetchLFS = true;
    });
    filter = path: type:
      # Retain proving and verification parameters, and no-lfs marker file ...
      (builtins.match ".*\.(no_lfs|param||bin)$" path != null) ||
      # ... as well as all the normal cargo source files:
      (craneLib.filterCargoSources path type);
  };
  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ clang openssl ];
  inherit system PKG_CONFIG_PATH LIBCLANG_PATH;
  cargoExtraArgs = "-p pd -p pcli -p pclientd -p pindexer";
}).overrideAttrs (_: { doCheck = false; })

It is not clear to me why the former fails with these file-not-found errors, but the latter succeeds.

@plaidfinch plaidfinch added C-bug Category: a bug A-tooling Area: developer tooling for building Penumbra itself labels Aug 3, 2024
@github-actions github-actions bot added the needs-refinement unclear, incomplete, or stub issue that needs work label Aug 3, 2024
@conorsch conorsch removed the needs-refinement unclear, incomplete, or stub issue that needs work label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tooling Area: developer tooling for building Penumbra itself C-bug Category: a bug
Projects
None yet
Development

No branches or pull requests

2 participants