nix-community / npmlock2nix

nixify npm based packages [maintainer=@andir]
Apache License 2.0
130 stars 42 forks source link

Integration into nixpkgs #87

Open happysalada opened 3 years ago

happysalada commented 3 years ago

Is your feature request related to a problem? Please describe. Just wondering if you have considered integration into nixpkgs. At the moment a lot of stuff in nixpkgs relies on mkYarnModules or node2nix. node2nix doesn't work properly with node 16 anymore so it's just a question of time before stuff breaks.

I'm just wondering what your thoughts are toward an integration into nixpkgs. Perhaps there are some feature set that you want to get done?

ryneeverett commented 3 years ago

I'm just wondering what your thoughts are toward an integration into nixpkgs. Perhaps there are some feature set that you want to get done?

I'd guess it's the MVP project: https://github.com/tweag/npmlock2nix/projects/1

happysalada commented 3 years ago

Here are some stuff I discovered that might be interesting. other 2nix tools written in nix (yarn2nix, poetry2nix) are merged in the nixpkgs repo by having the whole source in there.

I tried briefly to bring it into nixpkgs, but I found that I didn't know how to build a derivation from a nix expression. Using this with a flake is straightforward, but trying the same technique in nixpkgs did not work.

So my guess is that this is waiting for things to be more stable before it can be merged into nixpkgs.

andir commented 3 years ago

My personal plan was to have it in nixpkgs eventually but for that to happen I want to bunch of features to be more polished. I am not a nodejs developer myself and I only started working on this because I need to operate an image gallery that is unfortunately built with node :D.

What I really need in terms of feedback is actual node developers using this and feeding back what they think / what issues they encounter. I think we are pretty good on a "packaging software" basis but that is only half of the story. If your product uses this then your development environments should be managed in the same way.

ryneeverett commented 3 years ago

I tried briefly to bring it into nixpkgs, but I found that I didn't know how to build a derivation from a nix expression. Using this with a flake is straightforward, but trying the same technique in nixpkgs did not work.

I don't have any trouble using this in nixpkgs without flakes:

  npmlock2nix = callPackage (fetchFromGitHub {
    owner = "tweag";
    repo = "npmlock2nix";
    rev = "master";
    sha256 = "sha256-eRTG5eWjFN6i0CIPbt5XSeYjvIJ3nsmuS/5ggCVAMXg=";
  }) { };
happysalada commented 3 years ago

Amazing. I'm currently going through making the documentation for packaging javascript applications. https://github.com/NixOS/nixpkgs/pull/133593 I'm including a part on npmlock2nix. I'm thinking of including stuff that is already in the readme, just to make it easier to use. So far I've only encountered one issue, so I've mentioned it there. (at the time of writing this, the section on npmlock2nix is still empty. It shouldn't be by the end of the week though).

andir commented 3 years ago

I tried briefly to bring it into nixpkgs, but I found that I didn't know how to build a derivation from a nix expression. Using this with a flake is straightforward, but trying the same technique in nixpkgs did not work.

I don't have any trouble using this in nixpkgs without without flakes:

  npmlock2nix = callPackage (fetchFromGitHub {
    owner = "tweag";
    repo = "npmlock2nix";
    rev = "master";
    sha256 = "sha256-eRTG5eWjFN6i0CIPbt5XSeYjvIJ3nsmuS/5ggCVAMXg=";
  }) { };

This doesn't work within nixpkgs as that is IFD and that is not permitted within hydra.

ryneeverett commented 3 years ago

This doesn't work within nixpkgs as that is IFD and that is not permitted within hydra.

Right, it would not be accepted upstream. It's probably not a good idea to document this method either. It's a temporary hack until this issue is resolved.

happysalada commented 3 years ago

Yeah, I should probably just add a paragraph titled, Outside nixpkgs or something similar, and mention that this is only until this gets merged upstream and can only be used outside nixpkgs.