nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 131 lines 4.7 kB view raw
1{ 2 lib, 3 testers, 4 fetchtorrent, 5 emptyDirectory, 6 ... 7}: 8 9let 10 # This meta attribute isn't used anywhere, as the actual derivation 11 # realizations are only empty directories. It's maintained here as a record 12 # of the details of the intermediate product that exists briefly while 13 # building the test derivations. 14 # 15 # Ideally we'd use a smaller download, but neither of the Bittorrent backends 16 # supported by fetchtorrent appear to support torrents that are only reliably 17 # seeded by HTTP sources rather than other people using Bittorrent clients. 18 # Sintel was the smallest torrent I could find that had a free license and 19 # was reliably seeded by other Bittorrent clients. 20 # 21 # For more information, see the discussion at 22 # https://github.com/NixOS/nixpkgs/pull/432091/files/bd13421b2b70f3f125061018c800439ef2d43e8d#r2264073113 23 sintel.meta = { 24 description = "An open source short film to show off open source technologies."; 25 longDescription = '' 26 An independently produced short film, initiated by the Blender Foundation 27 as a means to further improve and validate the free/open source 3D 28 creation suite Blender. 29 ''; 30 license = lib.licenses.cc-by-30; 31 homepage = "https://durian.blender.org/"; 32 }; 33 34 # Via https://webtorrent.io/free-torrents 35 http.url = "${./test-sintel.torrent}"; 36 magnet.url = "magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent"; 37 38 # Sintel isn't a massive download, but it's not small. There's also no real 39 # value in storing copies of it in Nix caches, which is what happens by 40 # default when this test succeeds. Avoid that by verifying the downloaded 41 # files using `sha512sum` in the post-fetch hook, then deleting the files so 42 # the actual derivation result is an empty directory. 43 # 44 # Chain `&&` in the postFetch phase because the transmission backend does not 45 # run that phase with `errexit` enabled. 46 flattened.postFetch = '' 47 pushd "$out" && 48 sha512sum --check --strict ${./test-hashes.sha512sum} && 49 sed 's/.* //' ${./test-hashes.sha512sum} | xargs rm --verbose && 50 popd 51 ''; 52 unflattened.postFetch = '' 53 pushd "$out" && 54 pushd Sintel && 55 sha512sum --check --strict ${./test-hashes.sha512sum} && 56 sed 's/.* //' ${./test-hashes.sha512sum} | xargs rm --verbose && 57 popd && 58 rm --dir --verbose Sintel && 59 popd 60 ''; 61 62 fetchtorrentWithHash = 63 args: 64 fetchtorrent ( 65 { 66 # Fixed output derivation hash is identical for all derivations: the empty directory. 67 hash = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="; 68 69 # Reported in https://github.com/NixOS/nixpkgs/pull/458193#issuecomment-3575753211 70 # that these tests are causing Hydra to spin for hours on macOS. 71 # They all pass locally, and we don't care too much about running them on Hydra. 72 meta.hydraPlatforms = [ ]; 73 } 74 // args 75 ); 76in 77# Seems almost but not quite worth using lib.mapCartesianProduct... 78builtins.mapAttrs (n: v: testers.invalidateFetcherByDrvHash fetchtorrentWithHash v) { 79 http-link = { 80 inherit (http) url; 81 inherit (flattened) postFetch; 82 }; 83 http-link-transmission = { 84 inherit (http) url; 85 backend = "transmission"; 86 inherit (flattened) postFetch; 87 }; 88 magnet-link = { 89 inherit (magnet) url; 90 inherit (flattened) postFetch; 91 }; 92 magnet-link-transmission = { 93 inherit (magnet) url; 94 backend = "transmission"; 95 inherit (flattened) postFetch; 96 }; 97 http-link-rqbit = { 98 inherit (http) url; 99 backend = "rqbit"; 100 inherit (flattened) postFetch; 101 }; 102 magnet-link-rqbit = { 103 inherit (magnet) url; 104 backend = "rqbit"; 105 inherit (flattened) postFetch; 106 }; 107 http-link-rqbit-flattened = { 108 inherit (http) url; 109 backend = "rqbit"; 110 flatten = true; 111 inherit (flattened) postFetch; 112 }; 113 magnet-link-rqbit-flattened = { 114 inherit (magnet) url; 115 backend = "rqbit"; 116 flatten = true; 117 inherit (flattened) postFetch; 118 }; 119 http-link-rqbit-unflattened = { 120 inherit (http) url; 121 backend = "rqbit"; 122 flatten = false; 123 inherit (unflattened) postFetch; 124 }; 125 magnet-link-rqbit-unflattened = { 126 inherit (magnet) url; 127 backend = "rqbit"; 128 flatten = false; 129 inherit (unflattened) postFetch; 130 }; 131}