Nix unfree packages not working

I am trying to make a vscode tunnel with replit however, I get this error:

nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines
 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) [
      "vscode"
    ];
  }

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)

sh: 1: cowsay: not found
exit status 127
nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines
 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) [
      "vscode"
    ];
  }

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)```

But when I make .config/nixpkgs/config.nix and but allowUnfree = true; in it, it does not work and gives an infinite "loading nix environment". What should I do?
Repl: https://replit.com/@OwenLee11/vscode-testing
``` code language (e.g., "python") or "text"
Please format your code and output like this.
```
1 Like

Here’s the following on how to enable unfree

create the folder .config in your base dir (If you can’t create or it’s not visible, enable hidden files by pressing the 3 dots and pressing show hidden files)

Navigate to .config and create a folder named nixpkgs
Once there, create a file named config.nix (Path should be .config/nixpkgs/config.nix
Once there, insert:

{
    allowUnfree = true;
}

In the nix file, then goto your shell and type echo, it will reload and you will then have unfree enabled

1 Like

When I do that, it just makes the repl go into an infinite loading loop. It says Loading nix environment.

It’s probably due to the package, as when you have allowUnfree = true;, it will then load the package, with it being off it will be disabled, could you please link the repl so I can see the configuration?

2 Likes

I was using vscode, it was not working but I found a different way to do what I wanted. Thank you for your help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.