Skip to content

Add containers-lib to nix flake packages #407

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HeinrichApfelmus
Copy link
Contributor

This pull request adds an attribute containers-lib to the packages output in flake.nix. In this way, users can provision the containers-lib using Nix.

This is an addendum to #406 to make containers.agda-lib useable with Nix.

Note: This pull request also changes the version of the base-lib attribute to match the version 4.18 of the base package on Hackage.

@HeinrichApfelmus
Copy link
Contributor Author

@jespercockx Thanks! Could you merge the pull request? — I don't have any permissions on this repository. 😅

@HeinrichApfelmus
Copy link
Contributor Author

Actually, I think that there is something wrong when Nix typechecks the containers.agda-lib library: It tries to write local interface files for base.agda-lib into the nix store.

Somehow, transitive dependencies do not compose just yet (containers depends on base), not sure what to do here.

@liesnikov
Copy link
Contributor

do you mean these lines? https://github.com/agda/agda2hs/actions/runs/14793443918/job/41535343556#step:5:204 (and till 304 or so)
Because it seems like that was just a dependency build, so a separate derivation, as it should be. And then when containers it typechecked I don't see any re-checking of base.

@HeinrichApfelmus
Copy link
Contributor Author

do you mean these lines? https://github.com/agda/agda2hs/actions/runs/14793443918/job/41535343556#step:5:204 (and till 304 or so)

Yes and no.

And then when containers it typechecked I don't see any re-checking of base.

Yes. However, the problem is that agdaPackages.mkDerivation produces a result that is incompatible with agda2hs when used. I.e. agdaPackages produces self-consistent results in the nix store, but those results are not useable when trying to compile with adga2hs.

We need an equivalent agda2hs.mkDerivation. I have some code here:

https://github.com/HeinrichApfelmus/bags/blob/main/nix/lib.nix

but haven't managed to backport it yet.

@liesnikov
Copy link
Contributor

liesnikov commented May 16, 2025

Hmm, I'm not sure I understand exactly. What do you consider to be a "built derivation" for agda2hs?

If it's agda+agdai files and agda2hs then doesn't behave the same way agda proper does, I think I see the problem. I'd be surprised if agda2hs behaved very differently here, but it can be.
Or is it agda, agdai, and hs files, i.e. a self-contained compiled unit for all usages of agda2hs?

@HeinrichApfelmus
Copy link
Contributor Author

If it's agda+agdai files and agda2hs then doesn't behave the same way agda proper does, I think I see the problem. I'd be surprised if agda2hs behaved very differently here, but it can be.

Yep, that's indeed the case and the problem.

  • Agda puts .agdai files in a directory _build/2.7.0
  • The nixified agda2hs uses --local-interfaces (here:
    --add-flags "--local-interfaces"
    ) and expects the .agdai files to be colocated with the .agda files.

Consequently, when compiling a downstream file with agda2hs, the --local-interfaces options causes agda2hs to attempt to write an .agdai file to the nix store.

@liesnikov
Copy link
Contributor

liesnikov commented May 16, 2025

Ah, indeed.
That file should probably stay in sync with nixpkgs' source for agda, which by now dropped --local-interfaces, afaik
I just couldn't find a way to (ab)use the upstream in a way that would work reliably, so I copied the file. It doesn't mean that there is no way to derive it programmatically though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants