You have to define pkgs somehow. You can not just leave away the let/in.
let
pkgs = import <nixpkgs> {};
in
pkgs.mkShell {
packages = [
pkgs.rakudo
pkgs.zef
pkgs.rlwrap
pkgs.gnuplot
];
}
This built succesfully for me.
rakudo doesn’t seem to have a withPackages, and also all the attributes are toplevel anyway and not some rakudo packages.