Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Better automation of the kali-tools.nix file #1

Open
2 tasks
AkechiShiro opened this issue Feb 11, 2024 · 1 comment
Open
2 tasks

Better automation of the kali-tools.nix file #1

AkechiShiro opened this issue Feb 11, 2024 · 1 comment

Comments

@AkechiShiro
Copy link
Owner

AkechiShiro commented Feb 11, 2024

There are a few improvements that could be made to fully automatically maintain, the tracker.

  • Automatically mark pkgs as todo if they raise a missing attribute exception.
  • Automatically mark pkgs as broken if they throw an error (i.e. Python 2 deprecated/removed) at evaluation.

Automatically mark packages as todo if they raise a specific exception

An update to the nix code is needed to automatically mark the pkg as "todo" if

<pkgname> = pkgs.<pkgname>;

Does not exist in Nixpkgs unstable

raises not found attribute exception, such as this one :

Nix traceback
error:
       … while calling the 'derivationStrict' builtin
     at /derivation-internal.nix:9:12:

        8|
        9|   strict = derivationStrict drvAttrs;
         |            ^
       10|

   … while evaluating derivation 'are-we-hackers-yet-stats'
     whose name attribute is located at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/stdenv/generic/make-derivation.nix:353:7while evaluating attribute 'buildCommand' of derivation 'are-we-hackers-yet-stats'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/build-support/trivial-builders/default.nix:98:16:

       97|         enableParallelBuilding = true;
       98|         inherit buildCommand name;
         |                ^
       99|         passAsFile = [ "buildCommand" ]while evaluating derivation 'are-we-hackers-yet-stats-builder'
     whose name attribute is located at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/stdenv/generic/make-derivation.nix:353:7while evaluating attribute 'text' of derivation 'are-we-hackers-yet-stats-builder'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/build-support/trivial-builders/default.nix:162:16:

      161|       ({
      162|         inherit text executable checkPhase allowSubstitutes preferLocalBuild;
         |                ^
      163|         passAsFile = [ "text" ]while evaluating derivation 'are-we-hackers-yet-stats-json'
     whose name attribute is located at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/stdenv/generic/make-derivation.nix:353:7while evaluating attribute 'text' of derivation 'are-we-hackers-yet-stats-json'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/build-support/trivial-builders/default.nix:162:16:

      161|       ({
      162|         inherit text executable checkPhase allowSubstitutes preferLocalBuild;
         |                ^
      163|         passAsFile = [ "text" ]while calling anonymous lambda

     at /home/zwei/project/opensource/arewehackersyet/stats.nix:11:24:

       10|     mapAttrs
       11|       (_: mapAttrs (_: pkg: if isString pkg then pkg else pkg.meta.name))
         |                        ^
       12|       kali.kaliGroups;

   error: attribute '"0trace"' missing

   at /home/zwei/project/opensource/arewehackersyet/kali-tools.nix:9:14:

        8|
        9|   "0trace" = pkgs."0trace";
         |              ^
       10|   "arping | iputils-arping" = pkgs.arping;

Automatically mark packages as broken if they throw an error

At the moment, I don't know if there is a way to differentiate both errors for the current builder code, but they do not happen at the same code paths during evaluation.

Nix traceback
error:
       … while calling the 'derivationStrict' builtin
     at /derivation-internal.nix:9:12:

        8|
        9|   strict = derivationStrict drvAttrs;
         |            ^
       10|

   … while evaluating derivation 'are-we-hackers-yet-stats'
     whose name attribute is located at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/stdenv/generic/make-derivation.nix:353:7while evaluating attribute 'buildCommand' of derivation 'are-we-hackers-yet-stats'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/build-support/trivial-builders/default.nix:98:16:

       97|         enableParallelBuilding = true;
       98|         inherit buildCommand name;
         |                ^
       99|         passAsFile = [ "buildCommand" ]while evaluating derivation 'are-we-hackers-yet-stats-builder'
     whose name attribute is located at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/stdenv/generic/make-derivation.nix:353:7while evaluating attribute 'text' of derivation 'are-we-hackers-yet-stats-builder'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/build-support/trivial-builders/default.nix:162:16:

      161|       ({
      162|         inherit text executable checkPhase allowSubstitutes preferLocalBuild;
         |                ^
      163|         passAsFile = [ "text" ]while evaluating derivation 'are-we-hackers-yet-stats-json'
     whose name attribute is located at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/stdenv/generic/make-derivation.nix:353:7while evaluating attribute 'text' of derivation 'are-we-hackers-yet-stats-json'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/build-support/trivial-builders/default.nix:162:16:

      161|       ({
      162|         inherit text executable checkPhase allowSubstitutes preferLocalBuild;
         |                ^
      163|         passAsFile = [ "text" ]while calling anonymous lambda

     at /home/zwei/project/opensource/arewehackersyet/stats.nix:11:24:

       10|     mapAttrs
       11|       (_: mapAttrs (_: pkg: if isString pkg then pkg else pkg.meta.name))
         |                        ^
       12|       kali.kaliGroups;while calling anonymous lambda

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/top-level/aliases.nix:45:11:

       44|     lib.mapAttrs
       45|       (n: alias:
         |           ^
       46|         removeDistributefrom call site

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/top-level/aliases.nix:46:9:

       45|       (n: alias:
       46|         removeDistribute
         |         ^
       47|           (removeRecurseForDerivationswhile calling 'removeDistribute'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/top-level/aliases.nix:32:22:

       31|   # sets from building on Hydra.
       32|   removeDistribute = alias: with lib;
         |                      ^
       33|     if isDerivation alias thenfrom call site

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/top-level/aliases.nix:33:8:

       32|   removeDistribute = alias: with lib;
       33|     if isDerivation alias then
         |        ^
       34|       dontDistribute aliaswhile calling 'isDerivation'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/lib/attrsets.nix:780:5:

      779|     # Value to check.
      780|     value: value.type or null == "derivation";
         |     ^
      781|

   … from call site

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/top-level/aliases.nix:47:12:

       46|         removeDistribute
       47|           (removeRecurseForDerivations
         |            ^
       48|             (checkInPkgs n alias)))while calling 'removeRecurseForDerivations'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/top-level/aliases.nix:25:33:

       24|   # to appear while listing all the packages available.
       25|   removeRecurseForDerivations = alias: with lib;
         |                                 ^
       26|     if alias.recurseForDerivations or falsefrom call site

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/top-level/aliases.nix:48:14:

       47|           (removeRecurseForDerivations
       48|             (checkInPkgs n alias)))
         |              ^
       49|       aliases;while calling 'checkInPkgs'

     at /nix/store/hwcgg7k1fwaqszsfvx82jbva129xrdjb-source/pkgs/top-level/aliases.nix:38:20:

       37|   # Make sure that we are not shadowing something from all-packages.nix.
       38|   checkInPkgs = n: alias:
         |                    ^
       39|     if builtins.hasAttr n super

   error: gnuradio3_7 has been removed because it required Python 2
@AkechiShiro AkechiShiro pinned this issue Feb 11, 2024
@AkechiShiro
Copy link
Owner Author

AkechiShiro commented Feb 11, 2024

Usage of builtin.tryEval can allow evaluating if an expression did evaluate successfully and outputs a boolean (true or false).

However I'm still missing what kinds of errors did the evaluation trigger, in order to be able to filter at the error evaluation level, something more precise is needed.

Maybe checking with builtin.hasAttr "xyz" pkgs before accessing to pkgs.xyz, this would probably solve the issue if the pkgs does not exists.

But for packages that exists but are broken, it still isn't enough.

@AkechiShiro AkechiShiro unpinned this issue Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant