I couldnt create usr share applications .desktop file for NixOS

Many people tried to help me but i failed. i dont have NixOS ~/.nix-profile/share folder. İ have nix profile but not share. there is just a file named as manifest. Also i tried this How do I create a custom application launcher in gnome shell? - #4 by efx but it said error: attribute ‘nixpkgs’ in selection path ‘nixpkgs.gnumericWrapped’ not found .I would like to do it from configuration.nix file. İ couldnt find easy script or derivation. Ty for those all helped ones.

How does your nix expression look like?

How did you then install it?

1 Like
(writeShellScriptBin "x11lxappearance" ''
  GDK_BACKEND=x11 lxappearance
  mkdir -p $out/share/applications
  cp $out/share/applications
'')

This is what i tried first
and second what i tried below.
i created overlays.nix on ~/.config/nixpkgs/
i added codes inside overlays.nix
i typed nix-env -iA nixpkgs.gnumericWrapped and then it gave error that i share before but result is fail
i didnt play with anything by that i mean i didnt change gnumeric script.
i wonder what i do wrong

and 3rd i tried below. from configuration.nix

(writeScriptBin "deneme144" ''
  #!/usr/bin/env xdg-open
  [Desktop Entry]
  Encoding=UTF-8
  Version=1.0
  Type=Application
  Terminal=false
  Exec=  notify-send hurma
  Name=deneme144
  cp $out/share/applications
  cp $out/share
'')

I am determined one to learn NixOS thanks to help of yours. Ty again.

This cp is missing a second argument, you are probably missing the source before the target.

Where? I do not see the error.

Whis would create a script in bin, where I am not even sure what it would do or if it is valid under the given shebang.

Don’t use nix-env unless you do not have any alternatives. Using the system configuration or home manager is always the better way.

This creates again a shell script, but not a desktop file.

To create a desktop file, either use makeDesktopItem (which I can not find any documentation about) or use runCommand/mkDerivation to actually create a desktop file in $out/share/applications rather than other builders which creates scripts that end up in $out/bin.

2 Likes

@NobbZ and all dead NixOS community.
This example is helped me. İ think people should check both Reddit and Discourse for informations.

{ pkgs, ...}: {
  programs.bash = {
    enable = true;
    bashrcExtra = ''
      . ~/oldbashrc
    '';
  };
}

This is my default home manager and i changed it to

{ pkgs, ...}: {
  programs.bash = {
    enable = true;
    bashrcExtra = ''
      . ~/oldbashrc
    '';
  };

xdg.desktopEntries.deneme350 = {

name = "deneme350";

genericName = " ";

exec = "notify-send hurma";
terminal = false;
icon = "your-location-for-icon";
type = "Application";

categories = [ " " ];
};
}

İ found solution from here https://www.reddit.com/r/NixOS/comments/scf0ui/comment/hu5uhov/?utm_source=share&utm_medium=web2x&context=3
warning : when i tried it i lost my aliases.