Magnet links apply to an entire collection of files, as snapshotted by the creator. There is no way to pick a single file and refer to it, immutably. It's all or nothing. Additionally, metadata besides the file contents will change the hash. This includes filenames, directory structure and piece length (chosen at snapshot time, by the creator).
All of these limitations are enough in practice to make magnets useless for widespread per-file distribution.
http://bittorrent.org/beps/bep_0003.html#info-dictionary
There are some things, beyond the content of the file, that will change the hash:
- Path of the file (nature_documentary.avi vs root/nature_documentary.avi)
- Name of the file (nature_documentary.avi vs nature_doc.avi)
- The pieces length
Trackers are added in the magnet link by adding parameters to the URI: see http://bittorrent.org/beps/bep_0009.html
Edit: in fact, my hasty, belated and superficial skimming suggests that IPFS is an implementation of just a DHT (presumably with some metadata and chunking built in)—i.e. it keeps data itself in about the same way that Bittorrent stores torrent descriptions in the Mainline DHT.