News for hackers. Stuff that matters.
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