From 84e915a779b456b51a5368d6b0ec8d095ffedeb9 Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Fri, 22 Jun 2018 12:41:29 +0100 Subject: cntr: init at 1.2.0 --- pkgs/applications/virtualization/cntr/default.nix | 24 +++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 pkgs/applications/virtualization/cntr/default.nix (limited to 'pkgs') diff --git a/pkgs/applications/virtualization/cntr/default.nix b/pkgs/applications/virtualization/cntr/default.nix new file mode 100644 index 00000000000..79dbddfab55 --- /dev/null +++ b/pkgs/applications/virtualization/cntr/default.nix @@ -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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 07068cc2917..1175915d6f9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15994,6 +15994,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 { }; -- cgit 1.4.1 From f10b935f84d068f616f335ad75a99f13af35337a Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Fri, 22 Jun 2018 12:12:40 +0100 Subject: breakpointHook: add for debugging failing builds Usuage: Add breakpointHook to your `buildInputs` like this: stdenv.mkDerivation rec { # ... buildInputs = [ breakpointHook ]; }); When the build fails as show in this example: pkgs.hello.overrideAttrs (old: { buildInputs = [ breakpointHook ]; postPatch = '' false ''; }); It will halt execution printing the following message: build failed in patchPhase with exit code 1 To attach to this build run the following command as root: cntr attach -t command cntr-/nix/store/ynyb4n82x2r7sldd58pbb405jdqh5f00-hello-2.10 Installing cntr and running the command will provide shell access to the build sandbox of failed build: sudo cntr attach -t command cntr-/nix/store/ynyb4n82x2r7sldd58pbb405jdqh5f00-hello-2.10 WARNING: bad ownership on /nix/var/nix/profiles/per-user/root, should be 1000 [nixbld@localhost:/var/lib/cntr]$ At /var/lib/cntr the sandbox filesystem is mounted. All commands and files of the system are still accessible within the shell. To execute commands from the sandbox use the `cntr exec` subcommand. --- pkgs/build-support/setup-hooks/breakpoint-hook.sh | 9 +++++++++ pkgs/top-level/all-packages.nix | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 pkgs/build-support/setup-hooks/breakpoint-hook.sh (limited to 'pkgs') diff --git a/pkgs/build-support/setup-hooks/breakpoint-hook.sh b/pkgs/build-support/setup-hooks/breakpoint-hook.sh new file mode 100644 index 00000000000..6bef786ac3a --- /dev/null +++ b/pkgs/build-support/setup-hooks/breakpoint-hook.sh @@ -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) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1175915d6f9..5a345407705 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { }; -- cgit 1.4.1