West Ham have appointed David Moyes as first-team manager on an 18-month contract, the Premier League club have announced.