Open
Description
Describe the bug
This flake.nix evaluates to an attribute set:
let
foo = "bar";
in
{
outputs = { self, nixpkgs }:
{
packages.x86_64-linux.devShell = nixpkgs.outputs.legacyPackages.x86_64-linux.hello;
};
}
however nix develop
(or nix build .#devShell
) results in the following error:
$ nix develop
error: --- Error ------------------------------------------------------------------------------------ nix
file '/nix/store/wvlsr8s3nysj0pmgdl7ndggpxc8za87f-source/flake.nix' must be an attribute set
(use '--show-trace' to show detailed location information)
I can make nix happy by moving the let
inside the outputs
definition:
{
outputs = { self, nixpkgs }:
let
foo = "bar";
in
{
packages.x86_64-linux.devShell = nixpkgs.outputs.legacyPackages.x86_64-linux.hello;
};
}
Expected behavior
I'm expecting the flake commands to allow top-level let
bindings; but maybe that's on purpose to ensure the flake.nix
stays as simple as possible?
nix-env --version
output
nix-env (Nix) 2.4pre20200721_ff314f1