Add icons and a desktop item

This commit is contained in:
Doron Behar 2021-05-15 11:30:34 +03:00
parent dec9acf9c9
commit 7e19c8863c
5 changed files with 38 additions and 4 deletions

View file

@ -30,14 +30,30 @@ include::./install.adoc[]
=== Adding `matlab` executables to your system
TODO:: Write this
With what was done now, you run Matlab from the command line with:
....
# Legacy nix users (inside a clone of this repo)
$(nix-build)/bin/matlab
# Flake nix users (without cloning)
nix run gitlab:doronbehar/nix-matlab
....
But it's likely you'd like to make Matlab survive garbage collections and add a
desktop launcher to your system. To do that you can follow one of the following
paths according to your setup.
==== For NixOS users with a flakes setup
==== For NixOS users without a flakes setup
==== Home Manager setup
== Previous work
TODO:: Add links to tviti's repo etc.
Core parts of this repo are based on
https://github.com/tviti/nix-cfg/tree/e6531426e86273e450c6133a0deae9008411fffd/pkgs/matlab[@tviti's
work]. My part was making it a bit more accessible for modern Nix flake setup,
and making the shell and steps a bit more approachable.

View file

@ -29,11 +29,29 @@
exit 2
fi
'';
desktopItem = pkgs.makeDesktopItem {
desktopName = "Matlab";
name = "matlab";
exec = "${builtins.placeholder "out"}/bin/matlab %F";
icon = "matlab";
# Most of the following are copied from octave's desktop launcher
categories = "Utility;TextEditor;Development;IDE;";
mimeType = "text/x-octave;text/x-matlab;";
extraEntries = ''
Keywords=science;math;matrix;numerical computation;plotting;
'';
};
in {
packages.x86_64-linux.matlab = pkgs.buildFHSUserEnv {
name = "matlab";
inherit targetPkgs;
extraInstallCommands = ''
install -Dm644 ${desktopItem}/share/applications/matlab.desktop $out/share/applications/matlab.desktop
install -Dm644 ${./icons/hicolor/256x256/matlab.png} $out/share/icons/hicolor/256x256/matlab.png
install -Dm644 ${./icons/hicolor/512x512/matlab.png} $out/share/icons/hicolor/512x512/matlab.png
install -Dm644 ${./icons/hicolor/64x64/matlab.png} $out/share/icons/hicolor/64x64/matlab.png
'';
runScript = runScriptPrefix + ''
exec $INSTALL_DIR/bin/matlab "$@"
'';
@ -60,7 +78,7 @@
exec bash
'';
};
packages.x86_64-linux.mlint = pkgs.buildFHSUserEnv {
packages.x86_64-linux.matlab-mlint = pkgs.buildFHSUserEnv {
name = "mlint";
inherit targetPkgs;
runScript = runScriptPrefix + ''
@ -68,7 +86,7 @@
'';
};
overlay = final: prev: {
inherit (self.packages.x86_64-linux) matlab matlab-shell mlint;
inherit (self.packages.x86_64-linux) matlab matlab-shell matlab-mlint;
};
devShell.x86_64-linux = pkgs.mkShell {
buildInputs = (targetPkgs pkgs) ++ [

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB