Giter Site home page Giter Site logo

clj2nix's People

Contributors

eraserhd avatar glittershark avatar hlolli avatar hxtmdev avatar j4m3s-s avatar jskrzypek avatar whittlesjr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

clj2nix's Issues

Git dependencies don't include the source-path on the classpath

It looks like dependencies using :git/url just pull the git repository directly into the classpath, rather than the source-paths inside that repository. For example, a dependency of:

borkdude/rewrite-edn {:git/url "https://github.com/borkdude/rewrite-edn"
                      :sha "a0f6b2aa9087b1dbed0ecc71ea48c0dbaa60d91b"}

becomes:

{
    name = "borkdude/rewrite-edn";
    path = pkgs.fetchgit {
      name = "rewrite-edn";
      url = "https://github.com/borkdude/rewrite-edn";
      rev = "a0f6b2aa9087b1dbed0ecc71ea48c0dbaa60d91b";
      sha256 = "17pn1iaib909s1l0idmg6pvpy4xi6s7jdlv1cf915ixx34a62dhi";
    };
  }

in the resulting deps.nix, when in actuality it should be something like

{
    name = "borkdude/rewrite-edn";
    path = "${pkgs.fetchgit {
      name = "rewrite-edn";
      url = "https://github.com/borkdude/rewrite-edn";
      rev = "a0f6b2aa9087b1dbed0ecc71ea48c0dbaa60d91b";
      sha256 = "17pn1iaib909s1l0idmg6pvpy4xi6s7jdlv1cf915ixx34a62dhi";
    }}/src";
  }

please, update the packages.

Issue output:

  trying https://repo.clojars.org/joda-time/joda-time/2.9.7/joda-time-2.9.7-.jar
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  curl: (22) The requested URL returned error: 404 Not Found
  error: cannot download joda-time_joda-time-2.9.7.jar from any mirror

name collision on dependency

I am working with a dep that is located at (for instance)

https://repo1.maven.org/maven2/com/github/jnr/jffi/1.2.23/jffi-1.2.23-native.jar

clj2nix wants to generate the deps.nix file for this dep with

{
    name = "com.github.jnr/jffi$native";
    path = pkgs.fetchMavenArtifact {
      inherit repos;
      artifactId = "jffi$native";
      groupId = "com.github.jnr";
      sha512 = "e8b8040df1135f2a7dd67161374ca9a76f978eeaf16ad72756363ef353fce6e67d0155682799fd54dedf6fda907eb809edd58d8948fd3c855ee1c24443538c18";
      version = "1.2.23";
    };
  }

..which is invalid of course

so I end up with

$ nix-build --show-trace
error: while evaluating the attribute 'buildInputs' of the derivation 'hello' at /home/myproj/default.nix:14:3:
while evaluating the attribute 'installPhase' of the derivation 'com_github_jnr_jffi$native-1.2.23' at /nix/store/n5rmm4yw7gk5w7sinbndimdndbdwzxqm-source/pkgs/build-support/fetchmavenartifact/default.nix:64:5:
invalid character '$' in name 'com_github_jnr_jffi$native-1.2.23.jar'

However, because clj2nix appears to want a convention that builds an URL from the above expression, and appends the version to the end of the url for the dependency and apparently the people who created this jffi-1.2.23-native did not follow this convention, I am now in a position where I cannot build with this dependency.

I am wondering if anyone has run into this and has workarounds for dealing with these kinds of dependencies?

Not respecting :mvn/repos?

Is it possible that this application doesn't include :mvn/repos in its operations? I have a few dependencies that are not hosted on maven central, so I add this line to my deps.edn:

:mvn/repos {"ias-releases" {:url "https://maven.mangoautomation.net/repository/ias-release/"}}

This works doing REPL or other normal operations, but clj2nix says that it can't find these dependencies.

Read :extra-paths attribute from aliases

It would be nice if :extra-paths could be read and populated the extraClasspaths by default. Right now you have to manually keep those two in sync.

If I pass in extraClasspaths I would like that to be combined with the :extra-paths from the aliases.
If I have multiple aliases with :extra-paths and use several of these aliases together with the clj2nix command I would also expect all of them to be added.

What do you think?

SNAPSHOT versions looks in the wrong place

I stumbled upon https://clojars.org/kitchen-async/versions/0.1.0-SNAPSHOT

Which will generate:

  {
    name = "kitchen-async";
    path = pkgs.fetchMavenArtifact {
      inherit repos;
      artifactId = "kitchen-async";
      groupId = "kitchen-async";
      sha512 = "0d6f8ce7b94b538e00e4a6719362dfe121b0db303906f46b638943c087ac1861442ea4896211110a06a01ecd5fab44dc7deb3b26d918c263be18751ff783492c";
      version = "0.1.0-SNAPSHOT";
    };
  }

This will look for:
https://repo.clojars.org/kitchen-async/kitchen-async/0.1.0-SNAPSHOT/kitchen-async-0.1.0-SNAPSHOT.jar

However, the resulting artifact won't exist:
https://repo.clojars.org/kitchen-async/kitchen-async/0.1.0-SNAPSHOT/

Seems if you provide the url attribute to the artifact it will work.

The installation of nix-prefetch-github seems to have changed slightly.

Hello hlolli.
Thanks.

building '/nix/store/bg2h31q4j4ff3km4w9n29hqikghclayn-clj2nix.drv'...

trying https://github.com/hlolli/clj2nix/archive/e6d09dd8c5cda68eb0534bd8501f2d5dcd7b2e95.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 156 100 156 0 0 2943 0 --:--:-- --:--:-- --:--:-- 2943
100 25784 0 25784 0 0 68211 0 --:--:-- --:--:-- --:--:-- 68211
unpacking source archive /private/tmp/nix-build-clj2nix.drv-0/e6d09dd8c5cda68eb0534bd8501f2d5dcd7b2e95.tar.gz
error: while evaluating the attribute 'passAsFile' of the derivation 'pnix' at /nix/store/1xl4yrp6yw69j9kyxdb7bby64vp4wwnj-nixpkgs-21.11pre294098.4df31757808/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'passAsFile' at /nix/store/1xl4yrp6yw69j9kyxdb7bby64vp4wwnj-nixpkgs-21.11pre294098.4df31757808/nixpkgs/pkgs/build-support/buildenv/default.nix:77:5:
while evaluating the attribute 'installPhase' of the derivation 'clj2nix-1.0.7' at /nix/store/1xl4yrp6yw69j9kyxdb7bby64vp4wwnj-nixpkgs-21.11pre294098.4df31757808/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating 'makeClasspaths' at /nix/store/sr70gvqwiql179j5jd76j9ay94drd4zm-clj2nix/deps.nix:30:24, called from /nix/store/sr70gvqwiql179j5jd76j9ay94drd4zm-clj2nix/default.nix:7:15:
while evaluating the derivation attribute 'name' at /nix/store/1xl4yrp6yw69j9kyxdb7bby64vp4wwnj-nixpkgs-21.11pre294098.4df31757808/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'name' at /nix/store/1xl4yrp6yw69j9kyxdb7bby64vp4wwnj-nixpkgs-21.11pre294098.4df31757808/nixpkgs/pkgs/build-support/fetchurl/default.nix:124:3:
attribute 'lib' missing, at /nix/store/8qsbrv8y6ifw1icmr9gv723m8g5krygi-default.nix:42:10

`-A:test` option or similar?

I'm using this to build rep with GraalVM's native-image. It's working for that part, but I want to . run tests after, and this has a :test alias that needs to be merged in. Is this a good idea?

EDIT: To be clear, this is in a release.nix, so it is a separate package that needs more dependencies, even though it uses the same src attribute.

Add support for -M and perhaps also -X

When using clj2nix with -A the only supported option I get the following warning:

WARNING: Use of -A with clojure.main is deprecated, use -M instead

I guess it would be good to support -M and also potentially -X.

Provide flake

I'd love to install this using a Nix flake rather than manually specifying the build!

Warnings on clojure >= 1.10.1.697

I'm seeing this when running clj2nix on clojure 1.10.1.727, which was introduced by this commit: NixOS/nixpkgs@43776fb

WARNING: When invoking clojure.main, use -M

I'll make a PR to condition the invocation based on the clojure version

Don't use pkgs as input

It is generally not allowed to use pkgs as an input in nixpkgs with a few small exceptions. It would be nice if you could use lib, fetchMavenArtifact instead.

Populate repos from :mvn/repos

At work we are using mirrors for both central and clojars, it would be nice if the property :mvn/repos was taken into account and overriding all the repos defined. Alternatively (second best) if you could provide a repo or a list of repos via the CLI clj2nix to affect this variable.

Hopefuly this config inside deps.edn:

{:mvn/repos {"central" {:url "https://artifactory.domain/artifactory/v-maven-releases"}
             "clojars" {:url "https://artifactory.domain/artifactory/v-maven-releases"}}
...

Would result in this:

let repos = [ "https://artifactory.domain/artifactory/v-maven-releases" ];

the '$' character is invalid.

The path name 'org_openjfx_javafx-base$mac-14.jar' is invalid: the '$' character is invalid. Path names are alphanumeric and can include the symbols +-._?= and must not begin with a period. Note: If 'org_openjfx_javafx-base$mac-14.jar' is a source file and you cannot rename it on disk, builtins.path { name = ... } can be used to give it an alternative name.

CLJFX = (import ~/cljfx/deps.nix { inherit pkgs; }).makeClasspaths {};

install CLJFX~ I can't.
deps.edn is
https://github.com/cljfx/cljfx

When I checked the .m2 folder, the received file name is like this.
org.openjfx/javafx-base-14-mac.jar

Thanks

Ability to get deps per alias

Since different aliases have different deps, woud it be useful to have the option to generate one nix file for each alias? Or is it better to run clj2nix multiple times and saving the different deps to different files?

I was thinking you could for example have deps-test.nix and then use it like clojure -Scp ${testClassp} -M:test.

Perhaps nicest would be to generate all the deps in the same file, but generate an attrset with aliases and within each a function to generate the classpath.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.