Nixpkgs/Create and debug packages: Difference between revisions
Tomodachi94 (talk | contribs) m ryantm link -> canonical Nixpkgs manual |
m →Using nix-shell for package development: Improve grammar in note about preConfigurePhase |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 197: | Line 197: | ||
You would have seen the dependencies downloading, but the ''bc-build'' directory remains empty. The build system would next invoke a builder with some arguments. You can obtain the exact name of the builder (usually '''bash''') and the arguments '''args''' of the builder (typically a shell script) by checking the corresponding value in: | You would have seen the dependencies downloading, but the ''bc-build'' directory remains empty. The build system would next invoke a builder with some arguments. You can obtain the exact name of the builder (usually '''bash''') and the arguments '''args''' of the builder (typically a shell script) by checking the corresponding value in: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
$ nix show | $ nix derivation show $(nix-instantiate .) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 249: | Line 249: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{Note| | {{Note|You do not need to run $preConfigurePhase explicitly, as it will already be run implicitly when running configurePhase.}} | ||
To list all functions which are declared in '''set''': | To list all functions which are declared in '''set''': | ||
| Line 379: | Line 379: | ||
Your program to test the library: | Your program to test the library: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ pkgs ? import <nixpkgs> { | { | ||
pkgs ? import <nixpkgs> { | |||
overlays = [ | |||
(final: prev: { | |||
stdenv.mkDerivation { | my-library = prev.callPackage ./my-library.nix { }; | ||
}) | |||
]; | |||
}, | |||
}: | |||
pkgs.callPackage ( | |||
{ | |||
stdenv, | |||
hello, | |||
pkg-config, | |||
} | my-library, | ||
}: | |||
stdenv.mkDerivation { | |||
pname = "something"; | |||
version = "1"; | |||
strictDeps = true; | |||
# host/target agnostic programs | |||
depsBuildBuild = [ | |||
hello | |||
]; | |||
# compilers & linkers & dependecy finding programs | |||
nativeBuildInputs = [ | |||
pkg-config | |||
]; | |||
# libraries | |||
buildInputs = [ | |||
my-library | |||
]; | |||
} | |||
) { } | |||
</syntaxhighlight> | </syntaxhighlight> | ||