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

agdaPackages.generic: init at v0.1 #95059

Merged
merged 1 commit into from Aug 12, 2020
Merged

Conversation

alexarice
Copy link
Contributor

Motivation for this change

Fixes #94932

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • 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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@turion

There appears to be no Everything.agda file. There is a Main.agda but I don't think it hits all the files using find (commented in code atm) takes a while and I think there might be some errors


preBuild = ''
echo "module Everything where" > Everything.agda
find src -name '*.agda' -and -not -name '*Lookup*' | sed -e 's/src\///;s/\//./g;s/\.agda$//;s/^/import /' >> Everything.agda
Copy link
Contributor

Choose a reason for hiding this comment

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

That's amazing. Maybe make this a function/option in the nixpkgs agda lib?

Copy link
Contributor

Choose a reason for hiding this comment

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

It could also be a function that computes a new derivation, given an agda src. In that case, it's possible to patch the automatically generated Everything file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I shamelessly stole this from https://github.com/UlfNorell/agda-prelude/blob/master/test/Makefile but I agree it could be made to work in general

pkgs/development/libraries/agda/generic/default.nix Outdated Show resolved Hide resolved
@turion
Copy link
Contributor

turion commented Aug 10, 2020

I could successfully build this.

@alexarice
Copy link
Contributor Author

Just waiting on effectfully/Generic#4 I think

@turion
Copy link
Contributor

turion commented Aug 10, 2020

Just waiting on effectfully/Generic#4 I think

Huh, so it doesn't build for you??

@alexarice
Copy link
Contributor Author

It does but only because I put in a hack to make sure no file containing the word Lookup is added to the Everything.agda file

@alexarice alexarice changed the title [WIP] agdaPackages.generic: init at 0.1 agdaPackages.generic: init at v0.1 Aug 10, 2020
@alexarice
Copy link
Contributor Author

Should be ready for review

standard-library
];

preBuild = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be really cool if this could be abstracted into the agdaPackages lib. Either as simple option generateEverythingFile = true; or a transformation withEverythingFile (fetchFromGitHub { ... }) on the source.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree but maybe this should a different PR. A potential problem with this is that you need a way to get where the source lives. This is given as the include field in the .agda-lib file but we don't currently extract it. This file could also contain multiple include sources

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should potentially be in preConfigure instead of preBuild but as agda packages don't really have a configure stage, this doesn't really matter

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, so let's touch this again when there is another library where this trick comes in handy.

pkgs/top-level/agda-packages.nix Show resolved Hide resolved
@turion
Copy link
Contributor

turion commented Aug 10, 2020

Ok, so this still builds. Looking good to me then.

@turion
Copy link
Contributor

turion commented Aug 10, 2020

If you want, you can speed the wait for merge by using https://github.com/apps/marvin-mk2

@NickHu NickHu merged commit 97538a9 into NixOS:master Aug 12, 2020
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.

Add agda library Generic
3 participants