I’m using runCommandNoCC
to package a trivial shell package. But what is the correct way to add version
and pname
or even meta
to such a trivial package?
For such a trivial package, should there even be a version attribute at all? What’s the need for this anyway?
trivial-builders.nix
runCommand' = runLocal: stdenv: name: env: buildCommand:
stdenv.mkDerivation ({
inherit name buildCommand;
passAsFile = [ "buildCommand" ];
}
// (lib.optionalAttrs runLocal {
preferLocalBuild = true;
allowSubstitutes = false;
})
// env);
...
runCommandNoCC = runCommand' false stdenvNoCC;
It’s just a curried function with 2 out of the 5 arguments applied. Just need to pass it a name, an attr set which can override other attrs, and the actual build command. So you would do something like:
let
pname = "script";
version = "1.0.2";
in
myscript = runCommandNoCC "${pname}-${version}" {
inherit pname version;
meta = {
description = ... ;
platforms = ... ;
}; }
''
actual build commands
'';
not sure if the parenthesis are necessary.
EDIT: they are not necessary