How to install deb or rpm

How can i install deb or rpm packages in nixos, because i can’t find these two programs in nixos pacgage base?

You package them yourself, you ask for help packaging them yourself, or if you can’t build from source you write a derivation that unpacks the deb/rpm using dpkg/whatever you use for rpms. dpkg comes with a setup hook for unpacking dpkg sources automatically, so it will then be a case of patching libs etc. I’d definitely recommend trying to package it first.

Between this question about deb/rpm and the one where you were asking how to install something directly from Github, I can’t help but feel that perhaps you are not asking the question you actually want answered. My sense is that despite the specifics of the questions you have posed, you don’t necessarily care about rpm/deb/github, but just about being able to run a piece of software.

If that’s the case, then there are many convenient technologies to run software through containerization or other means. A popular choice is Flatpak. If you are still trying to install Deskflow, that appears to be available on Flathub.

As much as declarative and reproducible is nice, it’s useful to know some of the escape hatches from nix / NixOS.

yes, i just would like to install it and run it, yes, one of them is Deskflow and another two are, Quiterss which is in the nixos software but it doesn’t work when i install it and third one is local-by-flywheel that i was using from AUR before, i was on CachyOS, but i would like to learn more about nixos declarative nature and switch fully.

quiterss depends on qt5 (insecure), and doesn’t seem to have had any github action in 4 years. Wouldn’t be surprised if it gets removed at some point. local-by-flywheel is probably doable. You have the AUR buildpkg. Here is a starter template:

let
  pkgs = import <nixpkgs> { };
  package =
    {
      dpkg,
      fetchurl,
      stdenv,
    }:
    stdenv.mkDerivation {
      pname = "local-by-flywheel";
      version = "9.2.8";
      src = fetchurl {
        url = "https://cdn.localwp.com/releases-stable/9.2.8+6882/local-9.2.8-linux.deb";
        hash = "sha256-b3J6RurIOIFEWVKjXmHG7APOe9pccfQ3EaEHlpR9IoI=";
      };
      nativeBuildInputs = [ dpkg ];

      installPhase = ''
        mkdir $out
        cp -r . $out
      '';
    };
in
pkgs.callPackage package { }

running nix-build (assuming you copied the contents into default.nix) will give you a derivation that contains the unpacked deb file. The rest of it is up to you or anyone else that wants to pick up the torch and do the rest of the work.

EDIT: on the theme of escape hatches, you could also spin up an arch distrobox, and run AUR packages out of there.

is it worth it to do all of those things, or instead use CachyOS with AUR where i can get almost any package, people are talking that nixos has more packages than arch but it doesn’t have many important ones like: betterbird, local-by-flywheel, Deskflow…

No one can tell you what makes sense for you. I couldn’t care less about any of those packages. They obviously matter to you, and if the other things on the NixOS menu don’t look appealing then I would definitely suggest sticking with a distro that packages them. Nothing wrong with Arch and friends.

but i also like an idea of easy backup and restore.

aconfmgr + chezmoi?

This was removed because no one was updating it quickly enough in nixpkgs.

nixpkgs won’t keep around insecure packages after a certain point.
So you’re better off sticking with whatever distro you’re on. (Unless you’re willing to help maintain this in a timely manner for nixpkgs.)