How to put a precompiled binary into Nix Store as executable?

I have a binary that can be downloaded from url and I need to put it into nix store, but it also needs to be executable.

I have come up with this:

{
  stdenv,
  fetchurl,
  lib,
  ...
}:

let
  readeckBinary = fetchurl {
    url = "https://codeberg.org/readeck/readeck/releases/download/0.16.0/readeck-0.16.0-linux-amd64";
    hash = "sha256-N+NVAQY5Kk423UhrVXKbjU7N6ftOv5Q8ZnrU3QIhpJA=";
  };
  fs = lib.fileset;
in
stdenv.mkDerivation {
  pname = "readeck";
  version = "0.16.0";

  src = fs.toSource {
    root = ./.;
    fileset = fs.unions [ ];
  };

  buildPhase = '''';

  installPhase = ''
    mkdir -p $out
    mkdir -p $out/bin
    cp ${readeckBinary} $out/bin/readeck
    chmod +x $out/bin/readeck
  '';
}

Then the binary is in result/bin/readeck

Is there a shorter way to the same this?

I know it’s not the proper way to put a precompiled binary instead of building it from the source code.

{
  stdenv,
  fetchurl,
  lib,
}:

stdenv.mkDerivation {
  pname = "readeck";
  version = "0.16.0";

  src = fetchurl {
    url = "https://codeberg.org/readeck/readeck/releases/download/0.16.0/readeck-0.16.0-linux-amd64";
    hash = "sha256-N+NVAQY5Kk423UhrVXKbjU7N6ftOv5Q8ZnrU3QIhpJA=";
  };

  installPhase = ''
    mkdir -p $out/bin
    cp ${src} $out/bin/readeck
    chmod +x $out/bin/readeck
  '';
}

is shorter. Not sure why you bothered with the fileset stuff.

I thought src requires a directory but apparently I was wrong. Thanks this looks much simpler!