Help, try to build simple package with `fetchFromGitHub`

Hello, I try to build a simple package with nix-buildand fetchFromGitHub and add the package outside of the Nixpkgs tree.

First I define $HOME/nixos/nixpkgs/video-downloadhelper/default.nix

❯ bat default.nix

with import <nixpkgs> {}; 

stdenv.mkDerivation rec {
  name = "video-downloadhelper";

  src = fetchFromGitHub {
    owner = "aclap-dev";
    repo = "video-downloadhelper";
    rev = "0i2rdb3z78860x5sln3jfyz91x3wm74wylbh6s5fm5i95lb1y4bd";
    sha256 = "1bc1654l5ilxinxd6mp5yqk8ddwwgg32l7qf9az1q1wl5rq07msp";
  };

  nativeBuildInputs = [ nodejs python3 ];

  buildInputs = [ youtube-dl ];

  installPhase = ''
    mkdir -p $out/bin
    cp video-downloadhelper.py $out/bin/video-downloadhelper
    patchShebangs $out/bin/video-downloadhelper
  '';

}

How to eliminate this error:

❯ nix-build -v
evaluating file '/nix/store/64l9zc42ba5r32rm55mj5c9sjbli2mp4-nixos-23.11/nixos/default.nix'
evaluating file '/nix/store/64l9zc42ba5r32rm55mj5c9sjbli2mp4-nixos-23.11/nixos/lib/minver.nix'
evaluating file '/nix/store/64l9zc42ba5r32rm55mj5c9sjbli2mp4-nixos-23.11/nixos/pkgs/top-level/impure.nix'
evaluating file '/nix/store/64l9zc42ba5r32rm55mj5c9sjbli2mp4-nixos-23.11/nixos/pkgs/top-level/default.nix'
# shortend ...

evaluating file '/nix/store/64l9zc42ba5r32rm55mj5c9sjbli2mp4-nixos-23.11/nixos/pkgs/development/web/nodejs/nodejs.nix'
evaluating file '/nix/store/64l9zc42ba5r32rm55mj5c9sjbli2mp4-nixos-23.11/nixos/pkgs/development/libraries/http-parser/default.nix'
querying info about '/nix/store/6apj5azh8h394s8yzxl92sp72b4wfx0l-video-downloadhelper' on 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/6apj5azh8h394s8yzxl92sp72b4wfx0l.narinfo'...
querying info about '/nix/store/r0hgsv6y67qs18ml92i62rnhhxzih1r2-source' on 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/r0hgsv6y67qs18ml92i62rnhhxzih1r2.narinfo'...
querying info about '/nix/store/pf2b4szyv42i5jnd6wh8riv08hy04ckc-python3.11-youtube-dl-2021.12.17' on 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/pf2b4szyv42i5jnd6wh8riv08hy04ckc.narinfo'...
querying info about '/nix/store/pa1bjm6qjyiw6qmwga24rhic5ll0v5zv-atomicparsley-20221229.172126.d813aa6' on 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/pa1bjm6qjyiw6qmwga24rhic5ll0v5zv.narinfo'...
these 2 derivations will be built:
  /nix/store/nwa2zywyhp4f3h1qgvf5fkxyzazcbnnh-source.drv
  /nix/store/n4gfk5hjfdl5hp3d2yyr6kh8cgxazbcd-video-downloadhelper.drv
these 3 paths will be fetched (3.11 MiB download, 23.38 MiB unpacked):
  /nix/store/pa1bjm6qjyiw6qmwga24rhic5ll0v5zv-atomicparsley-20221229.172126.d813aa6
  /nix/store/sdwrgzn5rpzkyssapvmp9wzsaimm40jh-glibc-locales-2.38-44
  /nix/store/pf2b4szyv42i5jnd6wh8riv08hy04ckc-python3.11-youtube-dl-2021.12.17
copying path '/nix/store/pa1bjm6qjyiw6qmwga24rhic5ll0v5zv-atomicparsley-20221229.172126.d813aa6' from 'https://cache.nixos.org'...
copying path '/nix/store/sdwrgzn5rpzkyssapvmp9wzsaimm40jh-glibc-locales-2.38-44' from 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/nar/162yx0qikskqm7m5vkzp0kpv3r3s3m6qpxcxwywvl2rha0g89yh1.nar.xz'...
downloading 'https://cache.nixos.org/nar/0f2ybvg9kn014ijxws7pfs3qalz4javr8zk1l07qbi48ry14dj86.nar.xz'...
copying path '/nix/store/pf2b4szyv42i5jnd6wh8riv08hy04ckc-python3.11-youtube-dl-2021.12.17' from 'https://cache.nixos.org'...
downloading 'https://cache.nixos.org/nar/1jqjzl4gwpqfswp4cp4jxcg8d3xxvn68dsblb1cd13q1rxws2lg6.nar.xz'...
building '/nix/store/nwa2zywyhp4f3h1qgvf5fkxyzazcbnnh-source.drv'...

trying https://github.com/aclap-dev/video-downloadhelper/archive/0i2rdb3z78860x5sln3jfyz91x3wm74wylbh6s5fm5i95lb1y4bd.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0    14    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
error: cannot download source from any mirror
error: builder for '/nix/store/nwa2zywyhp4f3h1qgvf5fkxyzazcbnnh-source.drv' failed with exit code 1;
       last 8 log lines:
       >
       > trying https://github.com/aclap-dev/video-downloadhelper/archive/0i2rdb3z78860x5sln3jfyz91x3wm74wylbh6s5fm5i95lb1y4bd.tar.gz
       >   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
       >                                  Dload  Upload   Total   Spent    Left  Speed
       >   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
       >   0    14    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
       > curl: (22) The requested URL returned error: 404
       > error: cannot download source from any mirror
       For full logs, run 'nix-store -l /nix/store/nwa2zywyhp4f3h1qgvf5fkxyzazcbnnh-source.drv'.
error: 1 dependencies of derivation '/nix/store/n4gfk5hjfdl5hp3d2yyr6kh8cgxazbcd-video-downloadhelper.drv' failed to build
zsh: exit 1     nix-build -v

❯ nix-store -l /nix/store/nwa2zywyhp4f3h1qgvf5fkxyzazcbnnh-source.drv

trying https://github.com/aclap-dev/video-downloadhelper/archive/0i2rdb3z78860x5sln3jfyz91x3wm74wylbh6>
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M  0     0    0     0>
^M  0    14    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404
error: cannot download source from any mirror

I think your rev is incorrect. Generally git hashes are 40 characters long, yours is 52 characters long. fcd3258aa51cc1112ba3ac9076f98200955b356b is the latest for that repo

thanks for your fast replay.
… and you `re right, the rev number was wrong.

beyond of this, I locate my misfortune, it was Error-Code 40,

         .................40 cm in front of my  local  screen 

bye

1 Like