{"id":16451007,"url":"https://github.com/adnelson/nix-node-packages","last_synced_at":"2025-03-23T08:32:33.239Z","repository":{"id":51070266,"uuid":"44779532","full_name":"adnelson/nix-node-packages","owner":"adnelson","description":"A bunch of NPM packages defined in the nix language.","archived":false,"fork":false,"pushed_at":"2021-05-25T06:08:55.000Z","size":2875,"stargazers_count":13,"open_issues_count":3,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-16T21:06:32.931Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adnelson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-22T23:39:16.000Z","updated_at":"2021-08-08T20:13:09.000Z","dependencies_parsed_at":"2022-09-04T03:41:35.652Z","dependency_job_id":null,"html_url":"https://github.com/adnelson/nix-node-packages","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adnelson%2Fnix-node-packages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adnelson%2Fnix-node-packages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adnelson%2Fnix-node-packages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adnelson%2Fnix-node-packages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adnelson","download_url":"https://codeload.github.com/adnelson/nix-node-packages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245078067,"owners_count":20557274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T10:06:51.946Z","updated_at":"2025-03-23T08:32:30.845Z","avatar_url":"https://github.com/adnelson.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nix node package repository\n\nThis is a collection of node packages expressed in the nix\nlanguage. They can be installed via the nix package manager. They have\nbeen generated by\n[nixfromnpm](https://github.com/adnelson/nixfromnpm). The packages\ndefined in this repo can be used as-is, for example as `buildInputs`\nor `propagatedBuildInputs` to other nix derivations, or can be used\nwith `nixfromnpm` to auto-generate more nix expressions for other node\npackages.\n\n## Using this library\n\nFirst I assume you have nix installed, or else why would you be using\nthis? ;)\n\nClone the repo:\n\n```bash\n$ git clone https://github.com/adnelson/nix-node-packages.git\n```\n\nThe expressions here refer to a `nixpkgs` path variable, so make sure\nyou have it your `NIX_PATH`. For example, to point it at your\n`nixpkgs` channel:\n\n```bash\n$ export NIX_PATH=\"$HOME/.nix-defexpr/channels:$NIX_PATH\"\n```\n\nAfter that you're free to do whatever you please with the\nlibrary. Packages are located under the top-level attribute\n`nodePackages`. An unqualified name will build the latest version (as\ndetermined by comparing package version names), while a particular\nversion can be referred to as shown below. For example, the following\ncommands build the latest version of `grunt`, and version `0.4.5`,\nrespectively:\n\n```bash\n$ nix-build nix-node-packages/nodePackages -A nodePackages.grunt\n$ nix-build nix-node-packages/nodePackages -A nodePackages.grunt_0-4-5\n```\n\n## If a package doesn't build\n\nThere are any number of reasons why a package might not build. Some of\nthe most common ones are:\n\n* The `nixfromnpm` tool wasn't able to generate the definition of one\n  of the package's dependencies. It will insert in the `brokenPackage`\n  function, which, as might be anticipated, never builds. Looking at\n  the call to `brokenPackage` will tell you why it couldn't build\n  it. In my experience, this is because `nixfromnpm`'s version range\n  checker is not completely up to spec, and it's unable to find a\n  version that satisfies the bounds given by a `package.json`. If this\n  is the case, the easiest way to fix it is to:\n  * See what version range `nixfromnpm` failed to resolve. E.g.\n    `foo@\u003e=1.2.3-bar \u003c2.3.4-baz.qux`.\n  * Use `npm` to manually build the package at the given version\n    bounds. E g. `npm install foo@\u003e=1.2.3-bar \u003c2.3.4-baz.qux`.\n  * See what version it ends up building. E.g. `foo@1.2.3-xyz`.\n  * Call `nixfromnpm` on that version. E.g.\n    `nixfromnpm -o /path/to/nix-node-packages -p 'foo%1.2.3-xyz'`.\n  * Replace the call to `brokenPackage` with `foo_1-2-3-xyz`.\n* The build fails with `npm` complaining about HTTP errors. This is\n  usually caused by a dependency that wasn't satified, likely because\n  `nixfromnpm` calculated the wrong dependency. In this case, use\n  steps similar to the above to find out what the actual dependency\n  should be, and modify the package definition to include the correct\n  one.\n* A package build script is attempting to do some hacky bullshit like\n  modifying its dependencies. This, of course, is not kosher in the\n  `nix` view of things. In this case, you'll probably want to\n  `nix-shell` into the package and see what it's trying to do. Figure\n  out how to stop it from doing these things, and supply `prePatch` or\n  `postPatch` steps to apply those changes.\n\nFixing broken packages can be a pain, but because the way nix works, you'll\nonly need to fix them once (although, getting that to propagate to\nfuture versions might not be as easy). If you fix a package here,\nplease feel free to make a pull request so that others can benefit.\n\n## Extending the libraries\n\nIt's possible that you'll want to add additional packages that haven't\nbeen defined here. Alternatively, you might have your own packages,\nperhaps private, that you want to generate expressions for, but not\nhave alongside all of the other packages in this repo. While you can\nalways write these packages by hand, it's easier to do this with\n`nixfromnpm`. It can be obtained\n[here](https://github.com/adnelson/nixfromnpm). As with fixes above,\nfeel free to pull request any new packages added, whether by hand or\nauto-generated.\n\n### Adding new packages to the central package set\n\n```bash\n$ nixfromnpm -p package1 -p package2 -o nix-node-packages\n```\n\nThis will calculate expressions for `package1` and `package2`, and\nplace the generated expressions alongside all of the existing\npackages.\n\n### Create a new package set which refers to the central set\n\n```bash\n$ nixfromnpm -p package1 -p package2 -o path/to/new/set --extend nix-node-packages\n```\n\nThis will calculate expressions for `package1` and `package2`, and\nplace them and their dependencies in `path/to/new/set`. However, any\ndependencies which exist in `nix-node-packages/nodePackages` will not\nneed to be fetched, and will not appear in `path/to/new/set`.\n\n### Generate a `default.nix` file from a project\n\nYou might have a project which has a `package.json` that specifies a\nbunch of dependencies. You can use `nixfromnpm` to generate\nexpressions for the package's dependencies, and output a `default.nix`\nfile for the package.\n\n```bash\n$ nixfromnpm -f path/to/project -o nix-node-packags\n```\n\n## Test-building all libraries\n\nThere is a script sibling to this readme which can be executed which\nwill build all of the node packages defined here, except ones which\nare marked as broken. To run it:\n\n```bash\n$ path/to/nix-node-packages/test_build_all.sh\n```\n\nWhere `path/to/nix-node-packages` is the path to this repo on your\nsystem.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadnelson%2Fnix-node-packages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadnelson%2Fnix-node-packages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadnelson%2Fnix-node-packages/lists"}