I am trying to create a .nix file that installs nvm
First I tried to add inside configuration.nix :
system.activationScripts = {
dotfiles = pkgs.lib.stringAfters [ "users" ]
''
curl NVM_URL | bash
''
}
}
But it complained bash and curl are not defined....
So I tried to create a small .nix package,
{ stdenv, fileurl };
stdenv.mkDerivation {
name="nvm-0.33.0"
builder = ./install.sh;
fileurl{
url: NVM_GIT_MASTER.zip;
};
}
But then it complain `cannot auto-call a function that has an argument without a default valu {'stdenv'}
After running nix-build --dry-run ./text,nix
What's going on? I am reading nix pages, and banging my head on the wall.
I should think the
not defined
error is because neither curl nor bash are present inPATH
when thesystem
derivation is built. The manual entry forsystem.activationScripts
says:So I guess for that reason you should have the minimum amount of code in
system.activationScripts
anyway.The
cannot autocall
error suggests that the package you wrote is being called without it's arguments supplied. The normal way to take care of this is to use the callPackage function in thepkgs.lib
set. You can find examples of its use throughout nixpkgs.I think you're not using nix the right way to solve whatever your objective is. It could be worth seeing if you can find existing config.nix that use node packages to see how that's done. Also I notice that there's already support for nodePackages in nix so perhaps that might help you. There's also the nixos channel on IRC that more helpful too.
Hope that helps!