test(tvix/glue/fetchurl): add output path tests for fetchurl

These are all derived from the FOD representation of the ATerm
serialization, so no new code necessary to calculate these hashes
correctly.

Change-Id: I8c5dacd2a8de3d5042c9dd56910511c19e1b9b31
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11788
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-06-11 16:47:09 +03:00 committed by flokli
parent ff40332864
commit a7bf5b975f
2 changed files with 41 additions and 1 deletions

View file

@ -1 +1 @@
[ /nix/store/y0r1p1cqmlvm0yqkz3gxvkc1p8kg2sz8-null /nix/store/06qi00hylriyfm0nl827crgjvbax84mz-notmuch-extract-patch /nix/store/06qi00hylriyfm0nl827crgjvbax84mz-notmuch-extract-patch /nix/store/06qi00hylriyfm0nl827crgjvbax84mz-notmuch-extract-patch ]
[ /nix/store/y0r1p1cqmlvm0yqkz3gxvkc1p8kg2sz8-null /nix/store/06qi00hylriyfm0nl827crgjvbax84mz-notmuch-extract-patch /nix/store/06qi00hylriyfm0nl827crgjvbax84mz-notmuch-extract-patch /nix/store/06qi00hylriyfm0nl827crgjvbax84mz-notmuch-extract-patch "/nix/store/06qi00hylriyfm0nl827crgjvbax84mz-notmuch-extract-patch" "/nix/store/b40vjphshq4fdgv8s3yrp0bdlafi4920-0r8nqa1klm5v17ifc6z96m9wywxkjvgbnqq9pmy0sgqj53wj3n12.nar.xz" "/nix/store/8kx7fdkdbzs4fkfb57xq0cbhs20ymq2n-0r8nqa1klm5v17ifc6z96m9wywxkjvgbnqq9pmy0sgqj53wj3n12.nar.xz" "/nix/store/y92hm2xfk1009hrq0ix80j4m5k4j4w21-0r8nqa1klm5v17ifc6z96m9wywxkjvgbnqq9pmy0sgqj53wj3n12.nar.xz" ]

View file

@ -22,4 +22,44 @@
name = "notmuch-extract-patch";
sha256 = "sha256-Xa1Jbl2Eq5+L0ww+Ph1osA3Z/Dxe/RkN1/dITQCdXFk=";
})
# The following tests use <nix/fetchurl.nix>.
# This is a piece of Nix code producing a "fake derivation" which gets
# handled by a "custom builder" that does the actual fetching.
# We access `.outPath` here, as the current string output of a Derivation
# still differs from the way nix presents it.
# It behaves similar to builtins.fetchurl, except it requires a hash to be
# provided upfront.
# If `unpack` is set to true, it can unpack NAR files (decompressing if
# necessary)
# If `executable` is set to true, it will place the fetched file at the root,
# but make it executable, and the hash is on the NAR representation.
# Fetch a URL.
(import <nix/fetchurl.nix> {
url = "https://test.example/owo";
name = "notmuch-extract-patch";
sha256 = "Xa1Jbl2Eq5+L0ww+Ph1osA3Z/Dxe/RkN1/dITQCdXFk=";
}).outPath
# Fetch a NAR and unpack it, specifying the sha256 of its NAR representation.
(import <nix/fetchurl.nix> {
url = "https://cache.nixos.org/nar/0r8nqa1klm5v17ifc6z96m9wywxkjvgbnqq9pmy0sgqj53wj3n12.nar.xz";
sha256 = "sha256-oj6yfWKbcEerK8D9GdPJtIAOveNcsH1ztGeSARGypRA=";
unpack = true;
}).outPath
# Fetch a NAR and unpack it, specifying its *sha1* of its NAR representation.
(import <nix/fetchurl.nix> {
url = "https://cache.nixos.org/nar/0r8nqa1klm5v17ifc6z96m9wywxkjvgbnqq9pmy0sgqj53wj3n12.nar.xz";
hash = "sha1-F/fMsgwkXF8fPCg1v9zPZ4yOFIA=";
unpack = true;
}).outPath
# Fetch a URL, specifying the *sha1* of a NAR describing it as executable at the root.
(import <nix/fetchurl.nix> {
url = "https://cache.nixos.org/nar/0r8nqa1klm5v17ifc6z96m9wywxkjvgbnqq9pmy0sgqj53wj3n12.nar.xz";
hash = "sha1-NKNeU1csW5YJ4lCeWH3Z/apppNU=";
executable = true;
}).outPath
]