How to use third-party packages in Nixos
If you are using nixos you can get a problem, while there is no package you need in package store
AppImage
just add appimage-run package
environment.systemPackages = with pkgs; [
appimage-run
...
and add this configuration for running *.appimage automatically
  # Turn on appimage support
  boot.binfmt.registrations.appimage = {
    wrapInterpreterInShell = false;
    interpreter = "${pkgs.appimage-run}/bin/appimage-run";
    recognitionType = "magic";
    offset = 0;
    mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
    magicOrExtension = ''\x7fELF....AI\x02'';
  };
(Source)
Flatpak
Enable Flatpak support
services.flatpak.enable = true;
and install this packages for user
  users.users."user" = {
    packages = with pkgs; [
      flatpak
      gnome.gnome-software # optionally
    ];
  };
or globally
environment.systemPackages = with pkgs; [
      flatpak
      gnome.gnome-software # optionally
      ...
  ]
(Source)
Standalone binaries
you need nix-ld to create separate environment for standalone binaries
Enable nix-ld support:
# Nix-ld
programs.nix-ld = {
enable = true;
};
Add basic list of dependencies from here
Ensure LD_LIBRARY_PATH is set
export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH
sudpo nixos-rebuild switch
Try to run your binary:
# ./obinskit
./obinskit: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
If it needs more dependencies, like in example, search this lib from index (install nix-index at first)
nix-locate --top-level libgobject-2.0.so.0 | awk '{print$1}' | sort | uniq | sort
add this package to programs.nix-ld.libraries  and run
sudpo nixos-rebuild switch
(Source)