Simple `runCommand` does not work

I have the following shell.nix:

let
  pkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/b05d2077ebe219f6a47825767f8bab5c6211d200.tar.gz";
  foo = pkgs.runCommand "name" { } ''exit 1'';
in
pkgs.mkShell { }

However,

❯ nix-build shell.nix
error: value is a string with context while a set was expected, at /home/skainswo/dev/research/lottery/shell.nix:5:1

What’s going wrong here?

Appears to be the error from error "value is a list while a set was expected" is too vague · Issue #963 · NixOS/nix · GitHub but I have no idea what in the world it’s trying to tell me.

The error message could be better - I think you’re missing an import though

let
  pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/b05d2077ebe219f6a47825767f8bab5c6211d200.tar.gz") { };
  foo = pkgs.runCommand "name" { } ''exit 1'';
in
pkgs.mkShell { }
1 Like

Ah, yes that was it! Thank you!