How can I install unfree nixpack such as google-chrome in Railway via Environment Variable
Hello! Could someone answer to me how I can install google-chrome nixpack in Railway without getting 'unfree' error? I want to install via Railway environment variables as per https://nixpacks.com/docs/configuration/environment.
I set the variable as below.
NIXPACKS_PKGS=google-chrome
I got the following error.
#8 24.41 installing 'setup-env'
#8 27.20 error: Package ‘google-chrome-104.0.5112.101’ in /nix/store/ybq0d98m9n7h2cc0l04lci2bhl7q7di5-source/pkgs/applications/networking/browsers/google-chrome/default.nix:163 has an unfree license (‘unfree’), refusing to evaluate.
#8 27.20
#8 27.20 a) To temporarily allow unfree packages, you can use an environment variable
#8 27.20 for a single invocation of the nix tools.
#8 27.20
#8 27.20 $ export NIXPKGS_ALLOW_UNFREE=1
#8 27.20
#8 27.20 Note: For nix shell, nix build, nix develop or any other Nix 2.4+
#8 27.20 (Flake) command, --impure must be passed in order to read this
#8 27.20 environment variable.
#8 27.20
#8 27.20 b) For nixos-rebuild you can set
#8 27.20 { nixpkgs.config.allowUnfree = true; }
#8 27.20 in configuration.nix to override this.
#8 27.20
#8 27.20 Alternatively you can configure a predicate to allow specific packages:
#8 27.20 { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
#8 27.20 "google-chrome"
#8 27.20 ];
#8 27.20 }
#8 27.20
#8 27.20 c) For nix-env, nix-build, nix-shell or any other Nix command you can add
#8 27.20 { allowUnfree = true; }
#8 27.20 to ~/.config/nixpkgs/config.nix.
#8 27.20 (use '--show-trace' to show detailed location information)
2 Replies
This is interesting. We should probably allow installing these types of packages with Nixpacks. Can you please create an issue in this repo https://github.com/railwayapp/nixpacks
GitHub
GitHub - railwayapp/nixpacks: App source + Nix packages + Docker = ...
App source + Nix packages + Docker = Image. Contribute to railwayapp/nixpacks development by creating an account on GitHub.
You could also try adding the
NIXPKGS_ALLOW_UNFREE=1
env variable in your settings.