diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 726884d7cd9c..f97d7b184af8 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -213,6 +213,7 @@ in {
   fluentd = handleTest ./fluentd.nix {};
   fluidd = handleTest ./fluidd.nix {};
   fontconfig-default-fonts = handleTest ./fontconfig-default-fonts.nix {};
+  freenet = handleTest ./freenet.nix {};
   freeswitch = handleTest ./freeswitch.nix {};
   freshrss = handleTest ./freshrss.nix {};
   frr = handleTest ./frr.nix {};
diff --git a/nixos/tests/freenet.nix b/nixos/tests/freenet.nix
new file mode 100644
index 000000000000..96dbb4caa129
--- /dev/null
+++ b/nixos/tests/freenet.nix
@@ -0,0 +1,19 @@
+import ./make-test-python.nix ({ pkgs, ... }: {
+  name = "freenet";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ nagy ];
+  };
+
+  nodes = {
+    machine = { ... }: {
+      services.freenet.enable = true;
+    };
+  };
+
+  testScript = ''
+    machine.wait_for_unit("freenet.service")
+    machine.wait_for_open_port(8888)
+    machine.wait_until_succeeds("curl -sfL http://localhost:8888/ | grep Freenet")
+    machine.succeed("systemctl stop freenet")
+  '';
+})
diff --git a/pkgs/applications/networking/p2p/freenet/default.nix b/pkgs/applications/networking/p2p/freenet/default.nix
index b8f64aba2ec3..9f4f1d841472 100644
--- a/pkgs/applications/networking/p2p/freenet/default.nix
+++ b/pkgs/applications/networking/p2p/freenet/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, jdk, bash, coreutils, substituteAll }:
+{ lib, stdenv, fetchurl, jdk, bash, coreutils, substituteAll, nixosTests }:
 
 let
   version = "build01494";
@@ -56,6 +56,8 @@ in stdenv.mkDerivation {
 
   dontUnpack = true;
 
+  passthru.tests = { inherit (nixosTests) freenet; };
+
   installPhase = ''
     mkdir -p $out/bin
     install -Dm555 $src $out/bin/freenet