{"action":"reopened","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/11748","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/11748/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/11748/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/11748/events","html_url":"https://github.com/NixOS/nixpkgs/issues/11748","id":122329760,"number":11748,"title":"Erlang packages support umbrella tracking issue","user":{"login":"gleber","id":33185,"avatar_url":"https://avatars.githubusercontent.com/u/33185?v=3","gravatar_id":"","url":"https://api.github.com/users/gleber","html_url":"https://github.com/gleber","followers_url":"https://api.github.com/users/gleber/followers","following_url":"https://api.github.com/users/gleber/following{/other_user}","gists_url":"https://api.github.com/users/gleber/gists{/gist_id}","starred_url":"https://api.github.com/users/gleber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gleber/subscriptions","organizations_url":"https://api.github.com/users/gleber/orgs","repos_url":"https://api.github.com/users/gleber/repos","events_url":"https://api.github.com/users/gleber/events{/privacy}","received_events_url":"https://api.github.com/users/gleber/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NixOS/nixpkgs/labels/6.topic:%20erlang","name":"6.topic: erlang","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2015-12-15T17:59:00Z","updated_at":"2016-09-30T09:31:23Z","closed_at":null,"body":"I am starting this issue to track progress of the effort started in #11651. I will be updating this issue with further developments and my implementation plans. If someone wants to jump in and work on it, please let me know (here or privately) to avoid work duplication.\r\n\r\n## Assumptions\r\nI am working on getting Erlang packages into Nix. The approach is similar to what is done for Haskell. Here are main points:\r\n- use Hex.pm as a source of tarballs (that's the only reasonable package respository for Erlang AFAIK)\r\n- use rebar3 (beta-quality version of rebar Erlang built tool which works with Hex.pm)\r\n- aim at automatically importing all of newest packages on Hex (including their transitive closures) use not-yet-developed set of tools\r\n- packages should include both source code and bytecode files\r\n\r\n## Current status\r\nThe following basic features are implemented already:\r\n- `fetchHex` automates fetching packages from Hex.pm CDN\r\n- `buildHex` which automates definition of Erlang packages to be fetched and built from Hex.pm CDN\r\n- support building packages which depend on other Erlang packages\r\n- support adding rebar3 plugins for compilation of packages\r\n- support building of packages with ports (using rebar3-pc plugin)\r\n- implemented hermetic bootstrap and build for rebar3\r\n- two versions of rebar3 are provided:\r\n-- `rebar3` is one with applied patch which makes it hermetic (forbids any attempts to download stuff from the internet)\r\n-- `rebar3-open` which is unmodified version of rebar3\r\n- #11818 - implemented support for nix-shell using ERL_LIBS (just run `nix-shell -A erlangPackages.lager.env`)\r\n- `hex2nix` automates creation of `pkgs/development/erlang-modules/hex-packages.nix` file based on hex.pm registry, which includes all buildable versions of packages, including multiple versions of the packages\r\n- `doc/erlang-users-guide.xml` contains documentation\r\n\r\n`master` includes rebar3, hex2nix, 3rebar3-nix-bootstrap helper tool and ~330 other Erlang packages.\r\n\r\nRebar3 depends on a concept of registry, which is usually fetched from S3. I've created a separate [github repo](https://github.com/gleber/hex-pm-registry-snapshots) in which I plan to snapshot that single file from S3. This will be done automatically using scripts.\r\n\r\n## Further work\r\n- implement support for multiple erlang versions\r\n- implement support for Elixir\r\n- implement running tests as part of the build\r\n- investigate if it makes sense to provide \"binary\" and/or \"binary and sources\" or just \"sources\" packages (there are some packages on Hex which provide some binaries which are useful to be put into user's environment)\r\n- instigate discussion with Erlang community about some sort of LTS package set\r\n- and much more along the way...\r\n\r\n## Shell support\r\nTo support nix-shell, I am thinking about the following approach. Create a rebar3 plugin which would read rebar.config and spew out files like:\r\n\r\nhttps://github.com/NixOS/nixpkgs/blob/82c673d4c9280ef025e75e6de2a55c7e2b6fc6d1/pkgs/development/erlang-modules/hex/esqlite.nix\r\n\r\nI.e. the plugin should assume that there is reasonable support for rebar3/hex-based packages present in Nixpkgs. This should work for default.nix with what is present in my main PR. To make shell.nix work properly, requires a bit more work. My idea was to follow in the footsteps of what haskell2nix does. It basically creates a special derivation with all included in the shell.nix packages, where these packages are symlinked into that derivation. Later in the `shellHook` it sets up ERL_LIBS to point to that derivation. This should make nix-shell work nicely based on shell.nix created by `rebar3 nix shell`.\r\n\r\n## Support for `nix-env`\r\nSupport for `nix-env` has been discouraged by @peti and @domenkozar as unsustainable and giving very little benefits."}}
{"actor":{"display_login":"domenkozar"}}