Determining license implications for full package tree

I installed rustdesk to test it, which is AGPL, and (I assume) is FOSS, however it would not let me install it without NIXPKGS_ALLOW_UNFREE=1

I assume this is because it uses unfree dependencies.

How would I go about finding out what packages it depends on that are unfree? Is this even possible?

Can you share the command you’re running and the error you get?

I just realized the information is there, however does it actually show all of the packages or is it lazily evaluating and just tells you the first one?

> nix-shell -p rustdesk        
error:
       … while calling the 'derivationStrict' builtin
         at «nix-internal»/derivation-internal.nix:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'shell'
         whose name attribute is located at /nix/store/6p1fv0wbwxyc0zhikcim3p7yybf356cz-nixos-26.05/nixos/pkgs/stdenv/generic/make-derivation.nix:647:11

       … while evaluating attribute 'buildInputs' of derivation 'shell'
         at /nix/store/6p1fv0wbwxyc0zhikcim3p7yybf356cz-nixos-26.05/nixos/pkgs/stdenv/generic/make-derivation.nix:718:11:
          717|           depsHostHost = hostHostOutputs;
          718|           buildInputs = hostTargetOutputs;
             |           ^
          719|           depsTargetTarget = targetTargetOutputs;

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: Refusing to evaluate package 'libsciter-4.4.8.23-bis' in /nix/store/6p1fv0wbwxyc0zhikcim3p7yybf356cz-nixos-26.05/nixos/pkgs/by-name/li/libsciter/package.nix:61 because it has an unfree license (‘unfree’)
       a) To temporarily allow unfree packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_UNFREE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowUnfree = true; }
       in configuration.nix to override this.

       Alternatively you can configure a predicate to allow specific packages:
         { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
             "libsciter"
           ];
         }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowUnfree = true; }
       to ~/.config/nixpkgs/config.nix.

Also, I know I could set the environment variable (and I did, I already have config.allowUnfree set as well)

Here, it tells you the answer to your question.

1 Like

Yes, but it doesn’t show all of the nonfree packages, just the first one it evaluates.

1 Like

That’s because the check is implemented by making the evaluation fail if the license isn’t permitted. This prevents downloading unfree software.

You can evaluate the tree and get all licenses from .meta attributes recursively, but there isn’t a built-in command for this. Easiest way to accomplish that is playing around in nix repl.

3 Likes