Cannot build a hello world program with Stack because of flag bytestring--lt-0_10_4

For bypassing the issue with the bytestring--lt flag:

Use --nix and --resolver with a former lts version for stack commands:

stack new myproject --nix --resolver lts-9.14
stack setup --nix --resolver lts-9.14
stack build --nix --resolver lts-9.14

It is not necessary, but so as to install a more recent version of stack:

First, we have to add the nixos-unstable channel so as to pick a more recent version of stack from it:

nix-channel --add 'https://nixos.org/channels/nixos-unstable' unstable
nix-channel --update

Then, update the nixos configuration.nix file so as to install the unstable version of stack:

{ config, pkgs, ... }:
  let
      unstable = import <unstable> {};
  in {
      environment.systemPackages = [ unstable.stack ];
}

and rebuild the system:

$ nixos-rebuild reboot