Getting platformio to compile using NASM

I’ve got a simple x86 assembly program I’m trying to build built under platformio.

I’ve got a bash script that calls

nasm -f bin -o build/main.bin src/main.asm
xxd -p build/main.bin build/main.hex

And now I’m trying to integrate it into PlatformIO so when I click on the build button it calls the script and compiles the asm file.

platformio.txt

[env:8088]
platform = native

# Custom build steps
build_flags = 
    -D CUSTOM_BUILD=1

# Define the build scripts
extra_scripts = pre:build_script.sh

However I get:

    nasm -f bin -o build/main.bin src/main.asm

            ^^^

SyntaxError: invalid syntax

Am I misunderstanding how to use the extra_scripts?

How do I get this working?

The PlatformIO Build System allows the user to extend the build process with custom scripts using the Python interpreter and the SCons construction tool…

Please see Advanced Scripting — PlatformIO latest documentation