News for hackers. Stuff that matters.
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by Alifatisk on Monday July 17, 2023 @03:14PM (#36762661)
I am currently using asdf, is there anything Nix does better than asdf?
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by jljljl on Monday July 17, 2023 @03:22PM (#36762737)
Two benefits to Nix that I can think of:

1. It has a wider range of packages available vs asdf. Asdf can support runtimes that have an asdf plugin, whereas Nix has over 80,000 packages available in it's registry

2. Nix also handles the dependencies for the packages you want to install. If you runtime requires a compiler, specific libraries, etc, Nix will ensure those are installed.

Of course, Nix can be challenging to get started with. If you want to try Nix but find the language intimidating, you can try something like Devbox first.

Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by rgoulter on Monday July 17, 2023 @11:00PM (#36767291)
Nix is a much more general purpose tool than asdf.

Nix can also be used to build Docker images, VM images, or configure a NixOS system. Nix's packages can also be run without being installed.

Specifically for setting up a development environment? As sibling pointed out, nix shells can provide native libraries.

With nix shell, it's also possible to have the shell be strictly 'pure', in that the shell's environment will only be what's declared in the Nix shell. Having that ensures that you're not relying on environment variables you set elsewhere, or stuff you installed elsewhere.

Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by drunner on Monday July 17, 2023 @04:56PM (#36763967)
Ok, as a nix noob. I find a given package, say `nixpkgs/3276b62e6639096014652132f4824ac2b4f2a2c4#nodejs`

Then what? How do I throw that in a configuration.nix or flake.nix file?

Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by breakds on Monday July 17, 2023 @05:04PM (#36764062)
For flake.nix, you add that to the inputs, for example, call it `nixpkgs-old`, and then reference the package of interest with:

`nixpkgs-old.legacyPacakges.linux-x86_64.node`, or something like below

``` let pkgs = import nixpkgs-old { system = "linux-x86_64"; } in pkgs.mkShell { packages = [ pkgs.node ]; } ```

Sorry i am not sure how to make code blocks look nicer here.

Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by jljljl on Monday July 17, 2023 @05:18PM (#36764252)
You can use 2 spaces after a newline to format it:

  let 
     pkgs = import nixpkgs-old { system = "linux-x86_64"; } 
  in 
     pkgs.mkShell { packages = [ pkgs.node ]; }

Combine this with the input statement in the comment below to get a decent flake. You can mix and match multiple inputs if you want to install different versions of packages
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by lucilleh on Monday July 17, 2023 @05:21PM (#36764291)
If you are unfamiliar with Nix, just install with devbox. That said, you can also do `nix profile install` but then you kinda lose that nice declarative layer that devbox has. Now for some reason if you really want to do advanced customization of nodejs, then make a flake. Overkill for nodejs tho. Rust maybe.
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by jljljl on Monday July 17, 2023 @05:10PM (#36764151)
A few ways to use it are:

1. Install in your global profile with the CLI:

  nix profile install nixpkgs/3276b62e6639096014652132f4824ac2b4f2a2c4#nodejs
2. In a flake.nix, you can set an input with the nixpkgs commit hash, like:

  inputs = {
    node-nixpkgs.url = "nixpkgs/3276b62e6639096014652132f4824ac2b4f2a2c4";
  };
...and then use nodejs from that `node-nixpkgs` input to get the exact version you wanted
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by jljljl on Monday July 17, 2023 @07:22PM (#36765483)
Cool bonus feature of Nixhub.io I wanted to share -- Package pages are linkable/bookmarkable!

So if you want to view all the versions available for NodeJS, you can visit https://nixhub.io/packages/nodejs

You can even link to a specific version with an anchor link. For example, you can see NodeJS 19.8.0 at https://nixhub.io/packages/nodejs#19.8.0

Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by I_am_tiberius on Monday July 17, 2023 @10:28PM (#36767058)
I've never used nixos so excuse this question: What is the difference between nixhub and the package search on https://search.nixos.org/packages ?
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by zuzuleinen on Monday July 17, 2023 @10:46PM (#36767193)
From a short look I see it uses devbox in the install instructions as opposed to nix-shell

Probably a polished design to promote devbox

Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by lucilleh on Monday July 17, 2023 @10:57PM (#36767277)
nixhub has the historical versions of a package, which you cannot get via nixos.org.
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by jljljl on Monday July 17, 2023 @10:56PM (#36767271)
https://search.nixos.org/packages only shows packages that are available on the latest stable and unstable releases of Nixpkgs. The means they only have a limited number of versions for a given package available. For example, Python on unstable only has 5 versions to choose from:

  - 2.7.18
  - 3.9.17
  - 3.8.17 
  - 3.11.4
  - 3.12.0b3
If you need something different, you need to find a specific commit of the NixOS/nixpkgs repo that has that version. This information is not indexed or searchable on the official package search. Nixhub.io provides an index of these older released commits, so you can find and install versions that aren't available in the latest Nix releases.

If you visit https://www.nixhub.io/packages/python, you can see we have a lot more versions available. Developers can use the Nix or Devbox references on that page to install the version they need.

Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by I_am_tiberius on Monday July 17, 2023 @11:11PM (#36767358)
Why is it necessary to have two platforms then? https://search.nixos.org/packages could just add older packages as well, right?
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by jljljl on Tuesday July 18, 2023 @12:21AM (#36767768)
I suppose they could, but for various reasons they haven’t.

We originally built this for Devbox users because it was a common request, and realized that it could help Nix users as well.

Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by mock-possum on Tuesday July 18, 2023 @01:55AM (#36768383)
Some fuzzy search as you type magic on the package search box would be a nice feature. Are you making money off of this?
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by jljljl on Tuesday July 18, 2023 @08:01PM (#36780600)
Fuzzy search is definitely on our todo list!
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by misterio7 on Tuesday July 18, 2023 @09:06AM (#36771524)
That's pretty sweet! Is the code open source? I'd love to see how it works.
Re:Show HN: Nixhub.io – Search Historical Versions of Nix Pa... by jljljl on Tuesday July 18, 2023 @04:15PM (#36778484)
We haven't open sourced it, but we are planning to write a deep dive on how we built the index and how the search service works.