You're almost there! Simply run a /3 cable instead of the /2 to the switch; this lets you run the switched hot using the cable's red wire, freeing up its white to be connected to neutral at the fixture end and capped off at the switch end. This is required for future use as per NEC 404.2(C):
(C) Switches Controlling Lighting Loads. The grounded
circuit conductor for the controlled lighting circuit shall be
provided at the location where switches control lighting
loads that are supplied by a grounded general-purpose
branch circuit for other than the following:
(1) Where conductors enter the box enclosing the switch
through a raceway, provided that the raceway is large
enough for all contained conductors, including a
grounded conductor
(2) Where the box enclosing the switch is accessible for
the installation of an additional or replacement cable
without removing finish materials
(3) Where snap switches with integral enclosures comply
with 300.15(E)
(4) Where a switch does not serve a habitable room or
bathroom
(5) Where multiple switch locations control the same lighting load such that the entire floor area of the room or space is visible from the single or combined switch locations
(6) Where lighting in the area is controlled by automatic
means
(7) Where a switch controls a receptacle load
Informational Note: The provision for a (future) grounded
conductor is to complete a circuit path for electronic lighting control devices.