I’m trying to install a specific version of mongodb using this command nix-shell -p mongodb-4_4
but get the below error.
error: Package ‘mongodb-4.4.13’ in /nix/store/q3w6aldk8khr1f6vd050r8ambymz43x4-nixos-22.05/nixos/pkgs/servers/nosql/mongodb/mongodb.nix:133 has an unfree license (‘SSPL’), 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: For `nix shell`, `nix build`, `nix develop` or any other Nix 2.4+
(Flake) command, `--impure` must be passed in order to read this
environment variable.
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) [
"mongodb"
];
}
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
(use '--show-trace' to show detailed location information)
I have set nixpkgs.config.allowUnfree = true;
in both my configuration.nix
and also in my home.nix
yet I still get this error.
Is there something I am missing here?