I am currently struggling to understand how I would install software when there is no existing package in nixpkgs
and make this available to users path.
Based on the “Your topic is similar to…” suggestion, this one seemed partially relevant:
- Use an overlay [1]
However, seems this would assume the package is already defined/available in nixpkgs
.
The particular piece of software I am trying to install is svg-term-cli
[2]. Since it’s published to npm
[3], one can invoke:
npm install -g svg-term-cli
However, I don’t want to install node
or npm
directly on my machine and bypass the nix-store. I would prefer to manage this via nix. I may have found a similar StackOverflow question and answer [4], but I am not able to adapt it to npm
.
I used nix repl -f '<nixpkgs>'
, however not able to locate this specific package:
$ nix repl -f '<nixpkgs>'
nix-repl> pkgs.nodejs.pkgs.svg-term-cli
error:
… while evaluating the attribute 'nodejs.pkgs.svg-term-cli'
at /nix/store/9cdyyswz19r66knbyscl7l42k69vhbib-source/pkgs/development/web/nodejs/nodejs.nix:317:7:
316|
317| passthru.pkgs = callPackage ../../node-packages/default.nix {
| ^
318| nodejs = self;
error: attribute 'svg-term-cli' missing
at «string»:1:1:
1| pkgs.nodejs.pkgs.svg-term-cli
| ^
nix-repl> pkgs.nodePackages_latest.svg-term-cli
error:
… while evaluating the attribute 'nodePackages_latest.svg-term-cli'
at /nix/store/9cdyyswz19r66knbyscl7l42k69vhbib-source/pkgs/top-level/all-packages.nix:3614:3:
3613|
3614| nodePackages_latest = dontRecurseIntoAttrs nodejs_latest.pkgs;
| ^
3615|
error: attribute 'svg-term-cli' missing
at «string»:1:1:
1| pkgs.nodePackages_latest.svg-term-cli
| ^
nix-repl> pkgs.nodePackages.svg-term-cli
error:
… while evaluating the attribute 'nodePackages.svg-term-cli'
at /nix/store/9cdyyswz19r66knbyscl7l42k69vhbib-source/pkgs/top-level/all-packages.nix:3616:3:
3615|
3616| nodePackages = dontRecurseIntoAttrs nodejs.pkgs;
| ^
3617|
error: attribute 'svg-term-cli' missing
at «string»:1:1:
1| pkgs.nodePackages.svg-term-cli
| ^
My expectations:
- build project from source with instructions defined in nix
- binary of project available in users PATH after
sudo darwin-rebuild switch --flake ...
- No need to install/manage
nodejs
andnpm
outside of nix
Would appreciate any help here, even if it’s for the general use case (ie, not using npm
but rather building a project from source and making it available in path.
[1] How to install version of a package that is newer then in nixpkgs (2021-12-06)
[2] GitHub - marionebl/svg-term-cli: Share terminal sessions via SVG and CSS