zero-to-nix
zero-to-nix copied to clipboard
Issue with page `src/pages/start/3.nix-develop.mdx`
Hey everyone - ran into a small error on the above page.
As I was working my way through, I was unable to run the command in Beyond language-specific environments:
nix develop "https://flakehub.com/f/DeterminateSystems/zero-to-nix/*#multi"
I got the following error (forgive the blind copy paste - don't have enough context yet to know what I could leave out!):
error:
… while calling the 'derivationStrict' builtin
at <nix/derivation-internal.nix>:34:12:
33|
34| strict = derivationStrict drvAttrs;
| ^
35|
… while evaluating derivation 'nix-shell'
whose name attribute is located at /nix/store/qkzr5clkyq7j6n43qs5ff73in6c3wacv-source/pkgs/stdenv/generic/make-derivation.nix:333:7
… while evaluating attribute 'nativeBuildInputs' of derivation 'nix-shell'
at /nix/store/qkzr5clkyq7j6n43qs5ff73in6c3wacv-source/pkgs/stdenv/generic/make-derivation.nix:377:7:
376| depsBuildBuild = elemAt (elemAt dependencies 0) 0;
377| nativeBuildInputs = elemAt (elemAt dependencies 0) 1;
| ^
378| depsBuildTarget = elemAt (elemAt dependencies 0) 2;
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: Package ‘terraform-1.8.3’ in /nix/store/qkzr5clkyq7j6n43qs5ff73in6c3wacv-source/pkgs/applications/networking/cluster/terraform/default.nix:52 has an unfree license (‘bsl11’), 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) [
"terraform"
];
}
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
Happy to send over any relevant details / system information, but the tutorial was my introduction to Nix, so followed download + setup instructions as it was presented here. Some high level sys details:
> nix --version
nix (Nix) 2.24.6
> cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
...
> uname -m
x64_64
Also, I run fish shell - not sure if that makes a difference.