Hello, kind nix people : )
I have a package of a multi package project that uses an unfree license and I get this error:
❯ nix build -Lv
warning: Git tree '/home/hhefesto/src/Tontine/robo-actuary' is dirty
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:37:12:
36|
37| strict = derivationStrict drvAttrs;
| ^
38|
… while evaluating derivation 'user-account-service-0.1.0.0'
whose name attribute is located at /nix/store/qmm7hgw60vp7vj9lma95hl329d0j3n6n-source/pkgs/stdenv/generic/make-derivation.nix:438:13
… while evaluating attribute 'buildInputs' of derivation 'user-account-service-0.1.0.0'
at /nix/store/qmm7hgw60vp7vj9lma95hl329d0j3n6n-source/pkgs/stdenv/generic/make-derivation.nix:493:13:
492| depsHostHost = elemAt (elemAt dependencies 1) 0;
493| buildInputs = elemAt (elemAt dependencies 1) 1;
| ^
494| depsTargetTarget = elemAt (elemAt dependencies 2) 0;
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: Package ‘tt-common-0.1.0.0’ in /nix/store/zdxbv7why72l2plp920vgxviinawgw02-cabal2nix-tt-common/default.nix:21 has an unfree license (‘unfree’), refusing to evaluate.
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) [
"tt-common"
];
}
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
In my flake I've tried to set allowUnfree to true like this without success:
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [ inputs.haskell-flake.flakeModule ];
perSystem = { self', system, ... }:
let
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [
"tt-common"
];
permittedInsecurePackages = [
"beekeeper-studio-5.1.5"
];
};
};
in {
haskellProjects.default = { ...
How can I achieve this?
You want _module.args: https://github.com/search?q=repo%3Anammayatri%2Fcommon%20_module.args&type=code
That worked! Thank you, @Srid !
Is there any resources to read up on how _module
works? What's the sort of things that should be set there?
Perhaps this may help: https://flake.parts/overlays.html#consuming-an-overlay
It comes from flake-parts
Last updated: May 25 2025 at 18:23 UTC