2022-02-02 18:57:43 +00:00
|
|
|
let
|
|
|
|
pkgs = import (builtins.fetchGit {
|
2022-02-03 17:16:43 +00:00
|
|
|
name = "pinned-nixpkgs-21.11";
|
|
|
|
url = "https://github.com/NixOS/nixpkgs/";
|
|
|
|
ref = "refs/heads/nixos-21.11";
|
|
|
|
rev = "860b56be91fb874d48e23a950815969a7b832fbc";
|
|
|
|
}) {};
|
2022-02-02 18:57:43 +00:00
|
|
|
|
|
|
|
# TODO: This is where I'd put our IPFS plugin (if we had one!!)
|
2022-02-03 17:16:43 +00:00
|
|
|
ipfs = import (pkgs.fetchFromGitHub {
|
|
|
|
owner = "obsidiansystems";
|
|
|
|
repo = "go-ipfs-swh-plugin";
|
2022-02-09 19:54:54 +00:00
|
|
|
rev = "cbd4a77f1da434e5ec08c1eb95fffeb8f1e1706c";
|
|
|
|
sha256 = "0bpm8yfqivcglv94v4baav80078qf843nih37cs5f0fgm805wd1g";
|
2022-02-03 17:16:43 +00:00
|
|
|
}) { inherit pkgs; };
|
2022-02-02 18:57:43 +00:00
|
|
|
|
|
|
|
# CID representing the SWHID
|
|
|
|
# https://archive.softwareheritage.org/browse/snapshot/c7c108084bc0bf3d81436bf980b46e98bd338453/directory/
|
|
|
|
# (no particular attachment to darkroom, it was just the example
|
|
|
|
# snapshot from the SWHID docs)
|
|
|
|
swhid_cid = "znDfqECWqk8VqwNL2ayyYnvJdwDN9qYqa2";
|
|
|
|
|
|
|
|
# CID pointing to GNU Hello on Git (taken from the Nix-IPFS
|
|
|
|
# integration docs)
|
|
|
|
known_good_cid = "baf4bcfgi2up65zpzhg2fmyi52kecqfhsaevbaha";
|
|
|
|
in
|
|
|
|
|
|
|
|
pkgs.nixosTest {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
machine = { config, pkgs, ... }: {
|
|
|
|
networking.firewall.enable = false;
|
2022-02-03 17:16:43 +00:00
|
|
|
networking.extraHosts = ''
|
|
|
|
0.0.0.0 archive.softwareheritage.org
|
|
|
|
'';
|
|
|
|
|
2022-02-02 18:57:43 +00:00
|
|
|
services.ipfs = {
|
|
|
|
enable = true;
|
|
|
|
apiAddress = "/ip4/127.0.0.1/tcp/2324";
|
2022-02-03 17:16:43 +00:00
|
|
|
package = ipfs;
|
2022-02-02 18:57:43 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
skipLint = true;
|
|
|
|
|
|
|
|
# TODO: Add bridge node (when we have a bridge)
|
|
|
|
testScript = ''
|
|
|
|
import json
|
|
|
|
import sys
|
|
|
|
|
|
|
|
machine.wait_for_unit('ipfs')
|
|
|
|
|
2022-02-03 17:16:43 +00:00
|
|
|
# The SWHID plugin is loaded
|
|
|
|
machine.succeed(
|
|
|
|
'journalctl -u ipfs | grep SWHID'
|
|
|
|
)
|
|
|
|
|
2022-02-02 18:57:43 +00:00
|
|
|
# Hangs forever because IPFS doesn't understand our CID
|
|
|
|
machine.fail(
|
|
|
|
'timeout 5 ipfs dag get ${swhid_cid}'
|
|
|
|
)
|
2022-02-03 17:16:43 +00:00
|
|
|
|
|
|
|
# SWH Archive servers are inaccessible from this machine
|
|
|
|
machine.fail(
|
|
|
|
'curl https://archive.softwareheritage.org'
|
|
|
|
)
|
2022-02-02 18:57:43 +00:00
|
|
|
'';
|
|
|
|
}
|