Package installed by Nix not in Mate desktop menu - menu

I have used Nix package manager to install Abiword in a Slackware/Salix install with Mate desktop. The application runs fine but it has not appeared in the main Menu. Is this usual for applications installed by Nix?

I got this working on openSUSE plasma-desktop by adding the following to my bashrc
export XDG_DATA_DIRS=~/.local/share/:~/.nix-profile/share:/usr/share
cp -f ~/.nix-profile/share/applications/*.desktop ~/.local/share/applications/
Then logging out or running kbuildsycoca4 rebuilds the start menu.
When I only set the XDG_DATA_DIRS, the icons would appear in the start menu. However kdelibs is trying to make those .desktop files executable and add a xdg-open shebang to them, which does not work since .nix-profile is not writeable.
Thus it was also necessary to copy the desktop files to a ~/.local/share/applications/, which however also needs the XDG_DATA_DIRS set to ~/.nix-profile, because the application icons still reside there.

Related

How do you get a launcher for firefox?

I hope that I'm tagging/asking on the correct page. I'm Using Linux Mint 6.0, but it could be OS independent.
So the used command for installing Firefox was
nix-env -iA nixpkgs.firefox-esr
When I type which firefox, I get:
/home/foo/.nix-profile/bin/firefox
So Linux Mint comes with Chrome preinstalled, which has a launcher, e.g. also in the start menu. How do I get that for firefox as well? I didn't find a tool to create such a launcher in Mint and I actually think, that nix should do that for me.
EDIT: I also found this page which seemed helpful and advertised e.g. the KDE Kickoff, but I wasn't able to get that one to run.
I can only speak for Ubuntu launchers, but other distros will have launcher files that will have a similar setup
TLDR, add ~/.nix-profile/share to XDG_DATA_DIRS env variable on login. Add the following to ~/.profile after nix loading commands
export XDG_DATA_DIRS=$HOME/.nix-profile/share:$XDG_DATA_DIRS
Explanation:
Installed packages via nix will have an immutable path in nix/store. ~/.nix-profile/bin/firefox is the derivation your current nix environment is linked to (if you update the firefox package, it'll point to the new one)
This means you can create a launcher file for that executable. Lets see if the firefox-esr derivation comes with a desktop launcher or not:
$ nix-build '<nixpkgs>' -A firefox-esr
This will build the package and give you a derivation path. For my current channel it is /nix/store/3iipcmiykgr4p34fg3rkicdz1bw584gm-firefox-102.2.0esr
If I check inside it, there is a .desktop file which defines Ubuntu launchers:
$ ls /nix/store/3iipcmiykgr4p34fg3rkicdz1bw584gm-firefox-102.2.0esr/share/applications
firefox.desktop
These files will also be available under ~/.nix-profile/share/applications so you can simply add that to XDG_DATA_DIRS env variable before boot
If an application did not have one, you can manually make one and add it under ~/.local/share/applications, then set the executable path to the nix one
So SuperSandro2000 explained in the comments, that firefox from nix ships with a .desktop file already. This can be easily added to the start menu and lies in
/nix/store/...-firefox-XXX.X/share/applications/firefox.desktop
If there is no such file included, the most direct way could be (imho) to just create a simple bash script:
#!/bin/bash
./home/foo/.nix-profile/bin/firefox & #Run Firefox
echo Firefox was started with PID $!
In order to make it runnable, enter chmod +x your_skript_name.sh. Afterwards, ./firefox 2> /dev/null & can be used instead to run it silently in the background.
You can also consider the developer/command line options for firefox (Archive) or this blog article here.
Maybe /usr/bin/menulibre is also the right application, it allows you to create .desktop files. This app can also be found by right-clicking on the start "menu".

Failed to run '/usr/local/go/bin/go env. The config change may not be applied correctly

Whenever i try save a go file inside vc code i get this pop up Failed to run '/usr/local/go/bin/go env. The config change may not be applied correctly. . Also there is any no go intelliSense, code navigation, and code editing support.
I guess, you are using go modules and have go.mod file inside project directory. In this case, inside VsCode, go to preferences. Under extensions, select Go. Untick checkbox labelled "Infer GOPATH from the workspace root." for both "User" and "Workspace".
Close all terminal and VsCode instance, and restart VsCode. It should no longer display the error, and prompt message to install Go Tools. Else you can manually install go tools from VsCode (pressing crtl/cmd + shift + P), which will bring back intellisense and linting.
In case you are using Mac OS and installed Go via homebrew add
"go.goroot": "/opt/homebrew/opt/go/libexec"
To your settings.json file. The path may be different. Check it via export GOROOT="$(brew --prefix golang)/libexec".
Also see install go on mac
I have solved this issue. The solution is that, create a new Golang project and move all the required logic files from older project to newer project and it will work. The problem is with .mod and .sum files. It is a older project that i have created on my other laptop that has Ubuntu based Feren OS. When I moved this project to my newer laptop that has Ubuntu based Zorin OS. It creates problem. So after trying lots of solution, I just created a new Golang project and moves all the required files and it works.

Run script using Qt Creator like environment

I try to run a deployment script using KDE Neon. I have started the script manually from bash and I got an error qmake would be not found.
When trying to run qmake directly from the bash I get the following error:
$ qmake -v
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
That bin folder is almost empty and contains no qmake. In the path /usr/lib/x86_64-linux-gnu/qt5/bin/ a full Qt installation can be found but no qmake as well. /usr/bin/qmake obviously is a link that is pointing to the missing /usr/lib/x86_64-linux-gnu/qt4/bin/qmake.
qmake works fine when using Qt Creator. The binary used by Qt Creator is /home/<user>/Qt/5.10.0/gcc_64/bin/qmake.
Obviously the /usr/... Qt installations aren't complete. First I thought about how to complete the installations and how to switch from Qt4 to Qt5. However Qt Creator obviously is able to use its own /home/... located Qt environment anyway and I would like to use it too when running a script outside Qt Creator.
Is there a way I can start scripts from bash using the same Qt environment as Qt Creator (without modifying the OS configuration)?
QtCreator itself only modifies the environemt, i.e. it sets
export PATH="/home/<user>/Qt/5.10.0/gcc_64/bin:$PATH"
export QTDIR="/home/<user>/Qt/5.10.0/gcc_64"
This can be verified by checking the "Build Environment" section in the "Projects" tab. When checking the environment for the run configuration there is one more that is needed for the compiled applications to find the correct .so files (The build env. is used to run build tools. The run env. is used to run the compiled application).
export LD_LIBRARY_PATH="/home/<user>/Qt/5.10.0/gcc_64/lib:$LD_LIBRARY_PATH"
So in order to easily use qmake/... from the command line, just create a script that sets these (and possibly others you defined for your build in QtCreator) and source it before compiling and it should work.
source ~/qt-home-init.sh
qmake ...

environment variable in desktop is different from terminal?

I use qtcreator to build my project. When I use Terminal to open qtcreator and build the project, it works. However, when I use Desktop to Open qtcreator, it shows that can't not found the library.
Accurately, I add the libs to environment variable so that I can use it Makefile to build the project in Terminal.
So I am confused if the environment variable is different between Terminal and Desktop.
The qt project file is process.pro.
Oh, we found that when we run .desktop file, it does not contain bash environment. So adding bash -i -c in [Exec] can solve it.

How to run Qtcreator from terminal in Ubuntu?

Hi I have QtInstalled with the official qt installer (I haven't used the package with the name "qtcreator").
I need to run QtCreator from terminal but I can't locate the executable.
I'm using Ubuntu 16.04.
Probably you can find the executable in opt directory the location will be as this /opt/Qt/Tools/QtCreator/bin and you can run it through terminal as ./qtcreator
Latest QtCreator should by default be installed in
${HOME}/Qt/Tools/QtCreator/bin/
And you have two start-up options, the executable qtcreator or the shell script qtcreator.sh
To run the executable, type
~/Qt/Tools/QtCreator/bin/qtcreator
To run the shell script, type
~/Qt/Tools/QtCreator/bin/qtcreator.sh
Whic one to use: From the top portion of qtcreator.sh, it states that if you have library name conflicts (such as having same library names used by qtcreator with your own LD_LIBRARY_PATH), you may want to start with the shell script, rather than the bare executable.
Windows linux subsystem users
In case you have ubuntu as a subsystem for win10, it's located in your AppData folder (installing with sudo apt install command):
Also, you cannot run qtcreator from terminal as graphical interface is not supported by defeault. You need to instal X-server app first (https://sourceforge.net/projects/xming/) and then you can run QT from terminal.
C:\Users\[YOUR_USERNAME]\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\usr\share\qtcreator
Or, it's in usr/lintian/overrides
But you should not modify anything inside this linux root, as it may lead to data loss.
For me it wasn't in the /opt directory, but rather the location I've chosen in the /home/user/ directory.
More specifically: /home/user/Qt5.12.1/Tools/QtCreator/bin/qtcreator

Resources