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

Agda don't install Everything module #110512

Merged
merged 2 commits into from Feb 3, 2021

Conversation

neosimsim
Copy link
Contributor

@neosimsim neosimsim commented Jan 22, 2021

Motivation for this change

agdaPackages.mkDerivation: don't install Everything module

The Everthing module is not part of a library and should therefore
not be copied to the nix store.

This is particularly bad, if the Everything module is defined in
an agda library included directory, e.g. consider an agda-lib with

include: .

and Everything.agda in the project root (.), in which case the
Everything module would become part of the library.
If multiple such projects are in the dependency tree, the Everything
module becomes ambiguous and the build would fail.

Things done

Exclude Everything.agda etc. from find in installPhase.

  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Ensured that relevant documentation is up to date

@neosimsim neosimsim force-pushed the agda-dont-install-Everything branch 2 times, most recently from 53231e9 to 112d0f1 Compare January 22, 2021 17:17
@neosimsim
Copy link
Contributor Author

@turion told me to mention you here, @alexarice.

pkgs/build-support/agda/default.nix Outdated Show resolved Hide resolved
@ofborg ofborg bot requested a review from alexarice January 22, 2021 20:09
@SuperSandro2000
Copy link
Member

This is a semi-automatic executed nixpkgs-review which is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch).
If you have any questions or problems please reach out to SuperSandro2000 on IRC.

Result of nixpkgs-review pr 110512 run on x86_64-linux 1

1 package marked as broken and skipped:
  • agdaPackages.iowa-stdlib
6 packages built:
  • agdaPackages.agda-categories
  • agdaPackages.agda-prelude
  • agdaPackages.cubical
  • agdaPackages.functional-linear-algebra
  • agdaPackages.generic
  • agdaPackages.standard-library

@SuperSandro2000
Copy link
Member

This is a semi-automatic executed nixpkgs-review which is checked by a human on a best effort basis and does not build all packages (e.g. lumo, tensorflow or pytorch).
If you have any questions or problems please reach out to SuperSandro2000 on IRC.

Result of nixpkgs-review pr 110512 run on x86_64-darwin 1

1 package marked as broken and skipped:
  • agdaPackages.iowa-stdlib
6 packages built:
  • agdaPackages.agda-categories
  • agdaPackages.agda-prelude
  • agdaPackages.cubical
  • agdaPackages.functional-linear-algebra
  • agdaPackages.generic
  • agdaPackages.standard-library

Copy link
Contributor

@turion turion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the changes mentioned by the other reviewers

@neosimsim
Copy link
Contributor Author

I did some refactorings to test the interfaceFile function. I basically moved the function definition to lib.nix, which is imported as agdaLib and exposed as agda.lib.

@ofborg ofborg bot requested a review from turion January 23, 2021 22:38
@neosimsim
Copy link
Contributor Author

Added assertion messages with the last push.

pkgs/top-level/agda-packages.nix Outdated Show resolved Hide resolved
pkgs/build-support/agda/default.nix Outdated Show resolved Hide resolved
Copy link
Contributor

@alexarice alexarice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work

pkgs/top-level/agda-packages.nix Outdated Show resolved Hide resolved
pkgs/top-level/agda-packages.nix Outdated Show resolved Hide resolved
@ofborg ofborg bot requested a review from alexarice January 24, 2021 12:21
@alexarice
Copy link
Contributor

Another option would be using lib.extend to add the functions to lib for this scope (instead of passing round lib and agdaLib everywhere

@neosimsim
Copy link
Contributor Author

Another option would be using lib.extend to add the functions to lib for this scope (instead of passing round lib and agdaLib everywhere

Sounds good. IIURC that also allow us to write pkgs.agdaPackages.lib.interfaceFile, which would also be better IMO. Unfortunately I don't know how to use lib.extend

I tried to replace

agdaLib = ...

with

lib = lib.extend (final: prev: {
  inherit (import ../build-support/agda/lib.nix {
    inherit lib;
  });
});

but this doesn't work.

@alexarice
Copy link
Contributor

alexarice commented Jan 24, 2021

Another option would be using lib.extend to add the functions to lib for this scope (instead of passing round lib and agdaLib everywhere

Sounds good. IIURC that also allow us to write pkgs.agdaPackages.lib.interfaceFile, which would also be better IMO. Unfortunately I don't know how to use lib.extend

I tried to replace

agdaLib = ...

with

lib = lib.extend (final: prev: {
  inherit (import ../build-support/agda/lib.nix {
    inherit lib;
  });
});

but this doesn't work.

You're first use of inherit doesn't really make sense here.

I think you want

lib = lib.extend (final: prev: import ../build-support/agda/lib.nix { inherit lib; });

On a side note I'm not sure if build-support is the right place for this to live, but I also don't know where would be better

EDIT: I made a mistake here, it should be { lib = prev; } instead of { inherit lib; } above

The Everthing module is not part of a library and should therefore
not be copied to the nix store.

This is particularly bad, if the Everything module is defined in
an agda library included directory, e.g. consider an agda-lib with

    include: .

and Everything.agda in the project root (.), in which case the
Everything module would become part of the library.
If multiple such projects are in the dependency tree, the Everything
module becomes ambiguous and the build would fail.
@neosimsim
Copy link
Contributor Author

On a side note I'm not sure if build-support is the right place for this to live, but I also don't know where would be better

I believe I have a applied every suggestion now, besides the location for lib. Would pkgs/development/agda-modules be the correct place? Or do we want to leave it?

EDIT: I made a mistake here, it should be { lib = prev; } instead of { inherit lib; } above

Of course, I posted it wrong before.

@alexarice
Copy link
Contributor

alexarice commented Jan 25, 2021

@NixOS/ofborg test agda

Edit: This might have been the wrong command

@SuperSandro2000
Copy link
Member

@ofborg test agda

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/339

@SuperSandro2000
Copy link
Member

The aarch64 tests fail. If it is unclear why just mark it broken. Then we can merge I think.

@turion
Copy link
Contributor

turion commented Feb 3, 2021

Looking at the ofborg log (https://github.com/NixOS/nixpkgs/pull/110512/checks?check_run_id=1763878523, https://logs.nix.ci/?key=nixos/nixpkgs.110512&attempt_id=aff76ab4-d296-4a6a-a582-812206b972b0) I'm finding this error:

Calling: /nix/store/s6m8wrj6jkw15b6v5zzjq5z2ffhav4sc-ghc-8.10.3-with-packages/bin/ghc -O -o /tmp/HelloWorld -Werror -i/tmp -main-is MAlonzo.Code.HelloWorld /tmp/MAlonzo/Code/HelloWorld.hs --make -fwarn-incomplete-patterns -fno-warn-overlapping-patterns
[  1 of 130] Compiling MAlonzo.RTE      ( MAlonzo/RTE.hs, MAlonzo/RTE.o )
Compilation error:
<no location info>: error:
    Warning: Couldn't figure out LLVM version!
             Make sure you have installed LLVM 9
<no location info>: error:
    Warning: Couldn't figure out LLVM version!
             Make sure you have installed LLVM 9
ghc: could not execute: opt
error: 
Traceback (most recent call last):
  File "/nix/store/rygmgy4c0p0q8qkgk6ackryylps2g3bm-nixos-test-driver/bin/.nixos-test-driver-wrapped", line 897, in run_tests
    exec(tests, globals())
  File "<string>", line 1, in <module>
  File "<string>", line 20, in <module>
  File "/nix/store/rygmgy4c0p0q8qkgk6ackryylps2g3bm-nixos-test-driver/bin/.nixos-test-driver-wrapped", line 422, in succeed
    raise Exception(
Exception: command `agda -l standard-library -i . -c HelloWorld.agda` failed (exit code 1)
cleaning up
killing machine (pid 10)
(0.00 seconds)

It seems that on aarch64-linux, llvm isn't properly installed. I don't believe that's related to this PR.

@alexarice
Copy link
Contributor

I'm not sure the aarch64 tests have ever worked

@turion
Copy link
Contributor

turion commented Feb 3, 2021

Indeed they failed on master as well. I reported on #111738 with additional context. So I think we should be able to merge. I'll try and address that failure separately.

@AndersonTorres AndersonTorres merged commit 8bf1bc6 into NixOS:master Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants