Use IPFS+SWHID derivation
This commit is contained in:
parent
ef9be2bda0
commit
565ebdc88a
32
default.nix
32
default.nix
@ -1,13 +1,18 @@
|
|||||||
let
|
let
|
||||||
pkgs = import (builtins.fetchGit {
|
pkgs = import (builtins.fetchGit {
|
||||||
name = "pinned-nixpkgs-21.11";
|
name = "pinned-nixpkgs-21.11";
|
||||||
url = "https://github.com/NixOS/nixpkgs/";
|
url = "https://github.com/NixOS/nixpkgs/";
|
||||||
ref = "refs/heads/nixos-21.11";
|
ref = "refs/heads/nixos-21.11";
|
||||||
rev = "860b56be91fb874d48e23a950815969a7b832fbc";
|
rev = "860b56be91fb874d48e23a950815969a7b832fbc";
|
||||||
}) {};
|
}) {};
|
||||||
|
|
||||||
# TODO: This is where I'd put our IPFS plugin (if we had one!!)
|
# TODO: This is where I'd put our IPFS plugin (if we had one!!)
|
||||||
ipfs = pkgs.ipfs;
|
ipfs = import (pkgs.fetchFromGitHub {
|
||||||
|
owner = "obsidiansystems";
|
||||||
|
repo = "go-ipfs-swh-plugin";
|
||||||
|
rev = "873e629ca345463a9b7aa80d53420593dbe9bdb2";
|
||||||
|
sha256 = "1knhqiyxjx7pnc41pl2qngfjhdgcgp7d1k58gbjwaab2bljh6dd7";
|
||||||
|
}) { inherit pkgs; };
|
||||||
|
|
||||||
# CID representing the SWHID
|
# CID representing the SWHID
|
||||||
# https://archive.softwareheritage.org/browse/snapshot/c7c108084bc0bf3d81436bf980b46e98bd338453/directory/
|
# https://archive.softwareheritage.org/browse/snapshot/c7c108084bc0bf3d81436bf980b46e98bd338453/directory/
|
||||||
@ -24,9 +29,14 @@ in
|
|||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
machine = { config, pkgs, ... }: {
|
machine = { config, pkgs, ... }: {
|
||||||
networking.firewall.enable = false;
|
networking.firewall.enable = false;
|
||||||
|
networking.extraHosts = ''
|
||||||
|
0.0.0.0 archive.softwareheritage.org
|
||||||
|
'';
|
||||||
|
|
||||||
services.ipfs = {
|
services.ipfs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
apiAddress = "/ip4/127.0.0.1/tcp/2324";
|
apiAddress = "/ip4/127.0.0.1/tcp/2324";
|
||||||
|
package = ipfs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
skipLint = true;
|
skipLint = true;
|
||||||
@ -43,9 +53,19 @@ in
|
|||||||
'ipfs --api /ip4/127.0.0.1/tcp/2324 dag get "${known_good_cid}"'
|
'ipfs --api /ip4/127.0.0.1/tcp/2324 dag get "${known_good_cid}"'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The SWHID plugin is loaded
|
||||||
|
machine.succeed(
|
||||||
|
'journalctl -u ipfs | grep SWHID'
|
||||||
|
)
|
||||||
|
|
||||||
# Hangs forever because IPFS doesn't understand our CID
|
# Hangs forever because IPFS doesn't understand our CID
|
||||||
machine.fail(
|
machine.fail(
|
||||||
'timeout 5 ipfs dag get ${swhid_cid}'
|
'timeout 5 ipfs dag get ${swhid_cid}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# SWH Archive servers are inaccessible from this machine
|
||||||
|
machine.fail(
|
||||||
|
'curl https://archive.softwareheritage.org'
|
||||||
|
)
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user