DeSmuME is a decent Nintendo DS emulator and allows the use of Action Replay codes to, well, cheat in your games. A notable defect of the Linux version of this emulator however, is the fact that there is currently no interface to insert them. Luckily, the cheats are saved in text format so you can just edit the correct configuration files to add them.

With DeSmuME not running, navigate to ~/.config/desmume/. In this folder you should see files having the same names as games you used with DeSmuME, but different file extensions. The .dct files are the ones of interest as this is where the cheats are stored per game. So to add cheats, simply use a text editor to open the file associated with the game of your choice.

In it, you will likely see a line stating ; cheats list. We will add the codes after this line. If there is no such line, you can probably just add it yourself. Next, find an Action Replay code of your choice. I will use this example code for Pokémon Diamond which gives you the maximum amount of cash by pressing L+R.

94000130 fcff0000
b21c4d28 00000000
b0000004 00000000
000002e4 000f423f
d2000000 00000000

To add this code to the .dst file, add a new line in it starting with AR. Follow it by a space and then a 1 to enable the cheat or a 0 to have it disabled. Finally, add the Action Replay code, by turning every new line of the blob above into a comma and removing the spaces from it. If you want to, you can add a description for this code at the end by typing a ; followed by your description. Your final line will look like this:

AR 1 94000130FCFF0000,B21C4D2800000000,B000000400000000,000002E4000F423F,D200000000000000 ; Max cash (Press L+R)

Now start up DeSmuME and load your game, the cheat code is ready for use. To disable it again, you can use the menu option or just change the 1 to a 0 as described in the previous paragraph.