about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Steinbach <tim@nequissimus.com>2021-02-21 18:34:07 -0500
committerTim Steinbach <NeQuissimus@users.noreply.github.com>2021-02-22 10:07:42 -0500
commitcb72a93d2e4d84c19599679a29794f9867443ef4 (patch)
tree9d014e5e5993e7d9f7639a7ac55ca27d3a8a443a
parenta59e1712867ed2b38b404adcc8f863d91b4ddcc3 (diff)
sbt-extras: Convert VM test into installCheckPhase
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/sbt-extras.nix16
-rw-r--r--pkgs/development/tools/build-managers/sbt-extras/default.nix87
3 files changed, 50 insertions, 54 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 89e2ee2722847..b0561c36fe4a3 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -345,7 +345,6 @@ in
   samba-wsdd = handleTest ./samba-wsdd.nix {};
   sanoid = handleTest ./sanoid.nix {};
   sbt = handleTest ./sbt.nix {};
-  sbt-extras = handleTest ./sbt-extras.nix {};
   sddm = handleTest ./sddm.nix {};
   searx = handleTest ./searx.nix {};
   service-runner = handleTest ./service-runner.nix {};
diff --git a/nixos/tests/sbt-extras.nix b/nixos/tests/sbt-extras.nix
deleted file mode 100644
index f1672bf20665c..0000000000000
--- a/nixos/tests/sbt-extras.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-import ./make-test-python.nix ({ pkgs, ...} : {
-  name = "sbt-extras";
-  meta = with pkgs.lib.maintainers; {
-    maintainers = [ nequissimus ];
-  };
-
-  machine = { pkgs, ... }:
-    {
-      environment.systemPackages = [ pkgs.sbt-extras ];
-    };
-
-  testScript =
-    ''
-      machine.succeed("(sbt -h)")
-    '';
-})
diff --git a/pkgs/development/tools/build-managers/sbt-extras/default.nix b/pkgs/development/tools/build-managers/sbt-extras/default.nix
index efc6523cd986f..06bf2c54678c2 100644
--- a/pkgs/development/tools/build-managers/sbt-extras/default.nix
+++ b/pkgs/development/tools/build-managers/sbt-extras/default.nix
@@ -1,6 +1,20 @@
-{ lib, stdenv, fetchFromGitHub, which, curl, makeWrapper, jdk, writeScript
-, common-updater-scripts, cacert, git, nixfmt, nix, jq, coreutils, gnused
-, nixosTests }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, which
+, curl
+, makeWrapper
+, jdk
+, writeScript
+, common-updater-scripts
+, cacert
+, git
+, nixfmt
+, nix
+, jq
+, coreutils
+, gnused
+}:
 
 stdenv.mkDerivation rec {
   pname = "sbt-extras";
@@ -28,41 +42,40 @@ stdenv.mkDerivation rec {
     wrapProgram $out/bin/sbt --prefix PATH : ${lib.makeBinPath [ which curl ]}
   '';
 
-  passthru = {
-    tests = { inherit (nixosTests) sbt-extras; };
-
-    updateScript = writeScript "update.sh" ''
-      #!${stdenv.shell}
-      set -xo errexit
-      PATH=${
-        lib.makeBinPath [
-          common-updater-scripts
-          curl
-          cacert
-          git
-          nixfmt
-          nix
-          jq
-          coreutils
-          gnused
-        ]
-      }
-
-      oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
-      latestSha="$(curl -L -s https://api.github.com/repos/paulp/sbt-extras/commits\?sha\=master\&since\=$oldVersion | jq -r '.[0].sha')"
+  doInstallCheck = true;
+  installCheckPhase = ''
+    $out/bin/sbt -h >/dev/null
+  '';
 
-      if [ ! "null" = "$latestSha" ]; then
-        nixpkgs="$(git rev-parse --show-toplevel)"
-        default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt-extras/default.nix"
-        latestDate="$(curl -L -s https://api.github.com/repos/paulp/sbt-extras/commits/$latestSha | jq '.commit.committer.date' | sed 's|"\(.*\)T.*|\1|g')"
-        update-source-version ${pname} "$latestSha" --version-key=rev
-        update-source-version ${pname} "$latestDate" --ignore-same-hash
-        nixfmt "$default_nix"
-      else
-        echo "${pname} is already up-to-date"
-      fi
-    '';
-  };
+  passthru.updateScript = writeScript "update.sh" ''
+     #!${stdenv.shell}
+     set -xo errexit
+     PATH=${
+       lib.makeBinPath [
+         common-updater-scripts
+         curl
+         cacert
+         git
+         nixfmt
+         nix
+         jq
+         coreutils
+         gnused
+       ]
+     }
+    oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
+     latestSha="$(curl -L -s https://api.github.com/repos/paulp/sbt-extras/commits\?sha\=master\&since\=$oldVersion | jq -r '.[0].sha')"
+    if [ ! "null" = "$latestSha" ]; then
+       nixpkgs="$(git rev-parse --show-toplevel)"
+       default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt-extras/default.nix"
+       latestDate="$(curl -L -s https://api.github.com/repos/paulp/sbt-extras/commits/$latestSha | jq '.commit.committer.date' | sed 's|"\(.*\)T.*|\1|g')"
+       update-source-version ${pname} "$latestSha" --version-key=rev
+       update-source-version ${pname} "$latestDate" --ignore-same-hash
+       nixfmt "$default_nix"
+     else
+       echo "${pname} is already up-to-date"
+     fi
+  '';
 
   meta = {
     description =