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

feat: introduce flake #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: introduce flake #15

wants to merge 1 commit into from

Conversation

olebedev
Copy link
Collaborator

@olebedev olebedev commented May 1, 2023

Motivation

Introduce Nix flake so it allows using this project from Nix flake based projects as well.
It's noteworthy that the default exported package is not a Nix package but a function that allows to build environments.

Test the changes

$ nix develop -c jest
$ nix develop -c js2nix --help

Resolves #4

@typetetris, @blaggacao, any feedback is very welcome.

@olebedev olebedev requested a review from pathway27 May 1, 2023 00:43
js2nix = pkgs'.callPackage ./. { };
in
{
default = js2nix;
Copy link

@blaggacao blaggacao May 2, 2023

Choose a reason for hiding this comment

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

I'd sort of expect this to be in a lib.${system} namespace. "Semantics over impl-detail [that it is system scoped]"

Choose a reason for hiding this comment

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

potentially even make that function curriable with an instance of pkgs:

lib.js2nix pkgs {
      package-json = ./package.json;
      yarn-lock = ./yarn.lock;
}

I always feel immediately at home when there is special consideration put to the handling of pkgs instance. 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the feedback around the lib namespace @blaggacao, that's good point! I'll incorporate it in coming commit.

@yangm97
Copy link

yangm97 commented Aug 24, 2023

I tried using this branch from a flake but all dependencies end up failing to build. For instance:

$ nix log /nix/store/r89z38dr2n8cmakjmhmcpbnp6wb37bmj-duration-0.2.2.tgz.drv
 
trying https://registry.yarnpkg.com/duration/-/duration-0.2.2.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: registry.yarnpkg.com
Warning: Problem : timeout. Will retry in 1 seconds. 3 retries left.
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: registry.yarnpkg.com
Warning: Problem : timeout. Will retry in 2 seconds. 2 retries left.
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: registry.yarnpkg.com
Warning: Problem : timeout. Will retry in 4 seconds. 1 retries left.
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: registry.yarnpkg.com
error: cannot download duration-0.2.2.tgz from any mirror

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

Successfully merging this pull request may close these issues.

Wire things up in a flake
3 participants