Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Get rid of Nix dependency #27

Open
5 tasks
nightkr opened this issue Jul 15, 2017 · 6 comments
Open
5 tasks

Get rid of Nix dependency #27

nightkr opened this issue Jul 15, 2017 · 6 comments

Comments

@nightkr
Copy link
Owner

nightkr commented Jul 15, 2017

As @Ma27 said in #26 (comment), not everyone can (Windows users) or wants to use Nix (yet, hopefully). Thus, being able to generate Nix builds without having it installed would help make it easier for upstreams to provide up-to-date build files.

  • Hash it ourselves instead of using nix-prefetch-scripts if it's not installed
  • Teach genNix about the "project" build, replacing sbtix-gen-all
  • Make sbt genNix the main entry point, rather than sbtix-gen
  • Drop the sbtix-gen* scripts
  • Publish to Maven Central! (eventually)
@Ma27
Copy link

Ma27 commented Aug 20, 2017

just though a little bit about a possible implementation: we might want to generate a package set which contains the name of the derivation and the src (which consists of URL and hash).

Instead of nix-prefetch-* scripts we could fetch the data using Scala and compute the hashes on our side (I just checked it - node2nix does the same for instance).
Then we need to refactor our sbtix.nix expressions to do things like the download when running nix-build or nix-shell.

Would you be fine with such an approach?

@nightkr
Copy link
Owner Author

nightkr commented Aug 20, 2017

All of that already works, nix-build should work without having ran sbtix-gen-* on the same machine. The only difference should be that we download it and calculate the hash in Scala, if nix-prefetch-* is not available.

@Ma27
Copy link

Ma27 commented Aug 20, 2017

if nix-prefetch-* is not available.

  • yeah that's why I want to compute the hash (optionally) on our side
  • but nix-prefetch-* stores the download artifacts in the Nix storewhich is immutable so we can't (and shouldn't) modify it, no?

@nightkr
Copy link
Owner Author

nightkr commented Aug 20, 2017

but nix-prefetch-* stores the download artifacts in the Nix storewhich is immutable so we can't (and shouldn't) modify it, no?

We can add stuff to it by running nix-store --add $PATH. It might be better to use that instead of nix-prefetch-*, since

  • nix-prefetch-* is not included with core Nix
  • It means a smaller behaviour difference between running genNix on computers with and without Nix, which makes testing easier

@nightkr
Copy link
Owner Author

nightkr commented Aug 20, 2017

Also, in preparation for this, we should probably rename genComposition to something less likely to cause conflicts. genNixDerivation perhaps? Or just merge it into genNix.

Ma27 added a commit to Ma27/Sbtix that referenced this issue May 3, 2018
This changes allows it to generate the hashes for the JAR's package set
without `nix-prefetch-scripts`, but `java.security.MessageDigest`
instead. In order to achieve this, the following changes have been
applied:

* Replaced old `nix-prefetch-url` invokation in `FindArtifactsOfRepo`
  with `MessageDigest`

* Use `Try[T]` for error handling of the artifact's fetcher.

* Fixed minor working-directory bug in `tests/template-generation`.

* Removed `nix-prefetch-scripts` from `sbtix-tool` closure.

* Fixed `sbtix` package build expression. When `.bat` files are present
  that are non-executable, `wrapProgram` can't create a wrapper. Instead
  `find . -executable` should be used to wrap files in `$out/bin`.

See nightkr#27
nightkr added a commit that referenced this issue May 5, 2018
…dency-for-hash-computations

Generate CheckSum using `java.security.MessageDigest`
@nightkr
Copy link
Owner Author

nightkr commented Jun 6, 2018

The project has moved to GitLab: https://gitlab.com/teozkr/Sbtix/merge_requests/27

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

No branches or pull requests

2 participants