Stream: nix

Topic: Haskell + Rust FFI


view this post on Zulip Srid (Jan 03 2024 at 14:04):

@Akhilesh Singh Bhadauriya wants to nixify https://github.com/piyushKumar-1/haskell_cac_client

This is basically a Haskell library with FFI bindings to Rust code in the same repo.

I have worked on a similar project two years ago: https://github.com/ArdanaLabs/yubihsm-ed-sign

But now I'd like to use this opportunity to create a template repo for such projects, using haskell-flake and something for Rust.

view this post on Zulip Akhilesh Singh Bhadauriya (Jan 03 2024 at 15:06):

I tried to move this repo to nammayatri(https://github.com/nammayatri/nammayatri) so I'm getting this following error:

 … while calling the 'derivationStrict' builtin
         at /builtin/derivation.nix:9:12: (source not available)
       … while evaluating derivation 'ny-backend'
         whose name attribute is located at /nix/store/aiv6rdld7d7smj3rrh72da2sssl6z2xl-source/pkgs/stdenv/generic/make-derivation.nix:300:7
       … while evaluating attribute '__impureHostDeps' of derivation 'ny-backend'
         at /nix/store/aiv6rdld7d7smj3rrh72da2sssl6z2xl-source/pkgs/stdenv/generic/make-derivation.nix:435:7:
          434|       __propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
          435|       __impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ stdenv.__extraImpureHostDeps ++ [
             |       ^
          436|         "/dev/zero"
       (stack trace truncated; use '--show-trace' to show the full trace)
       error: function 'anonymous lambda' called without required argument 'cac_client'
       at /nix/store/l8awdgyzg1zanisz6xb492r6ybzzrnfc-cabal2nix-haskell-cac/default.nix:1:1:
            1| { mkDerivation, base, cac_client, lib }:
             | ^
            2| mkDerivation {
realpath: /Users/akhilesh.b/Desktop/nammayatri/.direnv/flake-profile.55906: No such file or directory
error: path '/Users/akhilesh.b/Desktop/nammayatri' is not in the Nix store
warning: Git tree '/Users/akhilesh.b/Desktop/nammayatri' is dirty
direnv: nix-direnv: renewed cache
direnv: export +XDG_DATA_DIRS ~PATH

Is this expected.

view this post on Zulip Srid (Jan 03 2024 at 15:17):

@Akhilesh Singh Bhadauriya What is the diff, exactly?

error: path '/Users/akhilesh.b/Desktop/nammayatri' is not in the Nix store

Your Nix seems to be referring to some absolute path.

view this post on Zulip Srid (Jan 03 2024 at 15:35):

You can put post the link to the branch on GitHub

view this post on Zulip Akhilesh Singh Bhadauriya (Jan 04 2024 at 10:34):

No but i'm trying to compile everything in local. This is just showing the path where my nammayatri repo is.

view this post on Zulip Shivaraj B H (Jan 04 2024 at 10:42):

It would be nice to see the code committed somewhere so that we can reproduce the issue

view this post on Zulip Akhilesh Singh Bhadauriya (Jan 04 2024 at 11:29):

You can find this here
https://github.com/nammayatri/nammayatri/tree/Backend/FFI-RUst/issue

view this post on Zulip Srid (Jan 04 2024 at 13:14):

You should not commit compiled assets like the target folder @Akhilesh Singh Bhadauriya

view this post on Zulip Srid (Jan 04 2024 at 13:17):

@Akhilesh Singh Bhadauriya The CI is not showing the error you report. Instead it is showing something else:

https://jenkins-nix-ci.betta-gray.ts.net/job/nammayatri/job/Backend%252FFFI-RUst%252Fissue/2/pipeline-console/

error: function 'anonymous lambda' called without required argument 'cac_client'

view this post on Zulip Srid (Jan 04 2024 at 13:17):

Which is understandable as we haven't written any Nix to a) build the Rust package, and b) make it available to the Haskell packages. Which is exactly what I plan to do next week.

view this post on Zulip Akhilesh Singh Bhadauriya (Jan 09 2024 at 13:54):

Nixified version of repo PR:
https://github.com/piyushKumar-1/haskell_cac_client/pull/2


Last updated: Nov 15 2024 at 11:45 UTC