GNU Octave Packages Fail to Install

Hello,

I am trying to install a package onto GNU Octave (basically free MATLAB). I thought that by installing the OctaveFull Nix package I would have all the basics that I would need, but it is still very minimalistic, and does not have necessary functions such as lsim() or ss() (I am studying control theory as part of my electronics degree). As such, I realised that I needed to install the control package. It is listed as octavePackages.control on the Nix package search site.

I have attempted installing it in numerous ways, such as directly under environment.systemPackages (as if it were an independent package), and with (octaveFull.withPackages (opkgs: with opkgs; [ control ])), which is itself part of the list under environment.systemPackages - it replaced my original octaveFull entry. None of these work, and the documentation is rubbish, which sucks considering this is a Nix-specific issue - normally its own package manager would work, but obviously under Nix it doesn’t succeed (I did try it just to make sure).

Does anyone know what to do?

Thanks in advance.

withPackages seems to work for me:

$ nix-shell --packages 'octave.withPackages (ps: with ps; [ control ])' --run 'octave --eval "pkg load control; help lsim"'
'lsim' is a function …

octaveFull just has the GUI enabled.

Can I have the GUI and the packages or would it be better to just use some other development suite (like emacs) and run the file from CLI? Because I tested it as you suggested and it worked, but it doesn’t load from within the GUI. Very strange. Interestingly, both octave.withPackages and octaveFull.withPackages work for the test command you made.

Thanks a lot. I never thought to test it without the GUI involved at all, as I assumed it would just be a frontend.

Edit: To answer my own question for others’ benefit, Emacs has a built in mode called Octave Mode, which spins up an Octave process and acts as its frontend. This means that octaveFull is redundant if one uses Emacs.

I get the same result in the GUI:

Okay, my computer is haunted then. It would not work in the GUI, no matter what I tried. Interestingly, Python also wouldn’t install any packages until I ran sudo nixos-rebuild switch like four times in a row. It kept giving me nonsense syntax errors until, without any changes made, it just worked. Definitely gremlins at play!