about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2020-05-08 10:51:21 +0100
committerGitHub <noreply@github.com>2020-05-08 10:51:21 +0100
commitddef88772e2b7659a79abceb4455e0fccdbab7f7 (patch)
tree499c1ca094928eb46eb5fae18bbcffdeb1a8ecc9
parentcdfad5ad841472941ee4a8f25fe05ad312b3f929 (diff)
parent11ace01cf28b1fff3584ef93537ba2ec2a8e5890 (diff)
downloadnixlib-ddef88772e2b7659a79abceb4455e0fccdbab7f7.tar
nixlib-ddef88772e2b7659a79abceb4455e0fccdbab7f7.tar.gz
nixlib-ddef88772e2b7659a79abceb4455e0fccdbab7f7.tar.bz2
nixlib-ddef88772e2b7659a79abceb4455e0fccdbab7f7.tar.lz
nixlib-ddef88772e2b7659a79abceb4455e0fccdbab7f7.tar.xz
nixlib-ddef88772e2b7659a79abceb4455e0fccdbab7f7.tar.zst
nixlib-ddef88772e2b7659a79abceb4455e0fccdbab7f7.zip
Merge pull request #86242 from lordcirth/ipfs05
-rw-r--r--nixos/modules/services/network-filesystems/ipfs.nix4
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/ipfs.nix58
-rw-r--r--pkgs/applications/networking/ipfs/default.nix15
4 files changed, 27 insertions, 51 deletions
diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix
index b6d881afd7bd..880f70ae1410 100644
--- a/nixos/modules/services/network-filesystems/ipfs.nix
+++ b/nixos/modules/services/network-filesystems/ipfs.nix
@@ -37,9 +37,7 @@ let
   baseService = recursiveUpdate commonEnv {
     wants = [ "ipfs-init.service" ];
     # NB: migration must be performed prior to pre-start, else we get the failure message!
-    preStart = ''
-      ipfs repo fsck # workaround for BUG #4212 (https://github.com/ipfs/go-ipfs/issues/4214)
-    '' + optionalString cfg.autoMount ''
+    preStart = optionalString cfg.autoMount ''
       ipfs --local config Mounts.FuseAllowOther --json true
       ipfs --local config Mounts.IPFS ${cfg.ipfsMountDir}
       ipfs --local config Mounts.IPNS ${cfg.ipnsMountDir}
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index ecdd30a6c50a..d9aee709f1cf 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -143,6 +143,7 @@ in
   initrdNetwork = handleTest ./initrd-network.nix {};
   installer = handleTest ./installer.nix {};
   iodine = handleTest ./iodine.nix {};
+  ipfs = handleTest ./ipfs.nix {};
   ipv6 = handleTest ./ipv6.nix {};
   jackett = handleTest ./jackett.nix {};
   jellyfin = handleTest ./jellyfin.nix {};
diff --git a/nixos/tests/ipfs.nix b/nixos/tests/ipfs.nix
index 3cff7e99ff88..4d721aec0c73 100644
--- a/nixos/tests/ipfs.nix
+++ b/nixos/tests/ipfs.nix
@@ -1,55 +1,25 @@
-
-import ./make-test.nix ({ pkgs, ...} : {
+import ./make-test-python.nix ({ pkgs, ...} : {
   name = "ipfs";
   meta = with pkgs.stdenv.lib.maintainers; {
     maintainers = [ mguentner ];
   };
 
-  nodes = {
-    adder =
-      { ... }:
-      {
-        services.ipfs = {
-          enable = true;
-          defaultMode = "norouting";
-          gatewayAddress = "/ip4/127.0.0.1/tcp/2323";
-          apiAddress = "/ip4/127.0.0.1/tcp/2324";
-        };
-        networking.firewall.allowedTCPPorts = [ 4001 ];
-      };
-    getter =
-      { ... }:
-      {
-        services.ipfs = {
-          enable = true;
-          defaultMode = "norouting";
-          autoMount = true;
-        };
-        networking.firewall.allowedTCPPorts = [ 4001 ];
-      };
+  nodes.machine = { ... }: {
+    services.ipfs = {
+      enable = true;
+      apiAddress = "/ip4/127.0.0.1/tcp/2324";
+    };
   };
 
   testScript = ''
-    startAll;
-    $adder->waitForUnit("ipfs-norouting");
-    $getter->waitForUnit("ipfs-norouting");
-
-    # wait until api is available
-    $adder->waitUntilSucceeds("ipfs --api /ip4/127.0.0.1/tcp/2324 id");
-    my $addrId = $adder->succeed("ipfs --api /ip4/127.0.0.1/tcp/2324 id -f=\"<id>\"");
-    my $addrIp = (split /[ \/]+/, $adder->succeed("ip -o -4 addr show dev eth1"))[3];
-
-    $adder->mustSucceed("[ -n \"\$(ipfs --api /ip4/127.0.0.1/tcp/2324 config Addresses.Gateway | grep /ip4/127.0.0.1/tcp/2323)\" ]");
-
-    # wait until api is available
-    $getter->waitUntilSucceeds("ipfs --api /ip4/127.0.0.1/tcp/5001 id");
-    my $ipfsHash = $adder->mustSucceed("echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | cut -d' ' -f2");
-    chomp($ipfsHash);
+    start_all()
+    machine.wait_for_unit("ipfs")
 
-    $adder->mustSucceed("[ -n \"\$(echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | grep added)\" ]");
+    machine.wait_until_succeeds("ipfs --api /ip4/127.0.0.1/tcp/2324 id")
+    ipfs_hash = machine.succeed(
+        "echo fnord | ipfs --api /ip4/127.0.0.1/tcp/2324 add | awk '{ print $2 }'"
+    )
 
-    $getter->mustSucceed("ipfs --api /ip4/127.0.0.1/tcp/5001 swarm connect /ip4/$addrIp/tcp/4001/ipfs/$addrId");
-    $getter->mustSucceed("[ -n \"\$(ipfs --api /ip4/127.0.0.1/tcp/5001 cat /ipfs/$ipfsHash | grep fnord)\" ]");
-    $getter->mustSucceed("[ -n \"$(cat /ipfs/$ipfsHash | grep fnord)\" ]");
-    '';
+    machine.succeed(f"ipfs cat /ipfs/{ipfs_hash.strip()} | grep fnord")
+  '';
 })
diff --git a/pkgs/applications/networking/ipfs/default.nix b/pkgs/applications/networking/ipfs/default.nix
index b94fc1addb0b..cd96e5a0547e 100644
--- a/pkgs/applications/networking/ipfs/default.nix
+++ b/pkgs/applications/networking/ipfs/default.nix
@@ -1,22 +1,29 @@
-{ stdenv, buildGoModule, fetchFromGitHub }:
+{ stdenv, buildGoModule, fetchFromGitHub, nixosTests }:
 
 buildGoModule rec {
   pname = "ipfs";
-  version = "0.4.23";
+  version = "0.5.0";
   rev = "v${version}";
 
   src = fetchFromGitHub {
     owner = "ipfs";
     repo = "go-ipfs";
     inherit rev;
-    sha256 = "19m1bhqf1jghdv2ngdnjdk1kvjcxbkgm1ccdkmkabv4ii43h8jwm";
+    sha256 = "0dbyvs49wyqj46c8hvz0fr4vpgfrdj1h8blniwzjf0jabgvw8nik";
   };
 
   postPatch = ''
     rm -rf test/dependencies
+    patchShebangs plugin/loader/preload.sh
   '';
 
-  modSha256 = "12m4ind1s8zaa6kssblc28z2cafy20w2jp80kzif39hg5ar9bijm";
+  buildPhase = ''
+    make install
+  '';
+
+  passthru.tests.ipfs = nixosTests.ipfs;
+
+  modSha256 = "00xgsvpl47miy6paxl8yn6p76h6ssccackh50z0l4r5s7wcc25q8";
 
   meta = with stdenv.lib; {
     description = "A global, versioned, peer-to-peer filesystem";