Merge pull request #42371 from Mic92/nix-breakpoints
breakpointHook: add for debugging failing builds
This commit is contained in:
commit
926d6c0bad
@ -2445,6 +2445,25 @@ addEnvHooks "$hostOffset" myBashFunction
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
breakpointHook
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This hook will make a build pause instead of stopping
|
||||
when a failure happen. It prevents nix to cleanup the build
|
||||
environment immediatly and allows the user to attach
|
||||
to a build environemnt using the <varname>cntr</varname> command.
|
||||
On build error it will print the instruction that are neccessary for cntr.
|
||||
Note that <varname>cntr</varname> is not installed by default and
|
||||
needs to be installed seperatly. <varname>cntr</varname> also needs to be executed
|
||||
on the machine that is doing the build, which might be not the case
|
||||
when remote builders are enabled. <varname>cntr</varname> is only supported
|
||||
on linux based platforms.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</section>
|
||||
|
24
pkgs/applications/virtualization/cntr/default.nix
Normal file
24
pkgs/applications/virtualization/cntr/default.nix
Normal file
@ -0,0 +1,24 @@
|
||||
{ stdenv, rustPlatform, fetchFromGitHub }:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
name = "cntr-${version}";
|
||||
version = "1.2.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Mic92";
|
||||
repo = "cntr";
|
||||
rev = version;
|
||||
sha256 = "0lmbsnjia44h4rskqkv9yc7xb6f3qjgbg8kcr9zqnr7ivr5fjcxg";
|
||||
};
|
||||
|
||||
cargoSha256 = "0gainr5gfy0bbhr6078zvgx0kzp53slxjp37d3da091ikgzgfn51";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A container debugging tool based on FUSE";
|
||||
homepage = https://github.com/Mic92/cntr;
|
||||
license = licenses.mit;
|
||||
# aarch64 support will be fixed soon
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = [ maintainers.mic92 ];
|
||||
};
|
||||
}
|
9
pkgs/build-support/setup-hooks/breakpoint-hook.sh
Normal file
9
pkgs/build-support/setup-hooks/breakpoint-hook.sh
Normal file
@ -0,0 +1,9 @@
|
||||
breakpointHook() {
|
||||
local red='\033[0;31m'
|
||||
local no_color='\033[0m'
|
||||
|
||||
echo -e "${red}build failed in ${curPhase} with exit code ${exitCode}${no_color}"
|
||||
printf "To attach install cntr and run the following command as root:\n\n"
|
||||
sh -c "echo ' cntr attach -t command cntr-${out}'; while true; do sleep 99999999; done"
|
||||
}
|
||||
failureHooks+=(breakpointHook)
|
@ -977,6 +977,9 @@ with pkgs;
|
||||
|
||||
bruteforce-luks = callPackage ../tools/security/bruteforce-luks { };
|
||||
|
||||
breakpointHook = assert stdenv.isLinux;
|
||||
makeSetupHook { } ../build-support/setup-hooks/breakpoint-hook.sh;
|
||||
|
||||
bsod = callPackage ../misc/emulators/bsod { };
|
||||
|
||||
btrfs-progs = callPackage ../tools/filesystems/btrfs-progs { };
|
||||
@ -16010,6 +16013,8 @@ with pkgs;
|
||||
cni = callPackage ../applications/networking/cluster/cni {};
|
||||
cni-plugins = callPackage ../applications/networking/cluster/cni/plugins.nix {};
|
||||
|
||||
cntr = callPackage ../applications/virtualization/cntr { };
|
||||
|
||||
communi = libsForQt5.callPackage ../applications/networking/irc/communi { };
|
||||
|
||||
confclerk = callPackage ../applications/misc/confclerk { };
|
||||
|
Loading…
Reference in New Issue
Block a user