repath-studio: add nixos test
migrated from ngi-nix/ngipkgs Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
This commit is contained in:
@@ -1398,6 +1398,7 @@ in
|
||||
refind = runTest ./refind.nix;
|
||||
remark42 = runTest ./remark42.nix;
|
||||
renovate = runTest ./renovate.nix;
|
||||
repath-studio = runTest ./repath-studio.nix;
|
||||
replace-dependencies = handleTest ./replace-dependencies { };
|
||||
reposilite = runTest ./reposilite.nix;
|
||||
restartByActivationScript = runTest ./restart-by-activation-script.nix;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
name = "Repath Studio";
|
||||
|
||||
nodes = {
|
||||
machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
# enable graphical session + users (alice, bob)
|
||||
./common/x11.nix
|
||||
./common/user-account.nix
|
||||
];
|
||||
|
||||
services.xserver.enable = true;
|
||||
test-support.displayManager.auto.user = "alice";
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
xdotool
|
||||
repath-studio
|
||||
];
|
||||
|
||||
# electron application, give more memory
|
||||
virtualisation.memorySize = 4096;
|
||||
};
|
||||
};
|
||||
|
||||
enableOCR = true;
|
||||
|
||||
# Debug interactively with:
|
||||
# - nix run .#nixosTests.repath-studio.driverInteractive -L
|
||||
# - start_all()/run_tests()
|
||||
# ssh -o User=root vsock%3 (can also do vsock/3, but % works with scp etc.)
|
||||
interactive.sshBackdoor.enable = true;
|
||||
|
||||
testScript = /* python */ ''
|
||||
start_all()
|
||||
|
||||
machine.wait_for_x()
|
||||
machine.succeed("env DISPLAY=:0 sudo -u alice repath-studio &> /tmp/repath.log &")
|
||||
machine.wait_for_text(r"(Welcome|Repath|Studio)") # initial telemetry prompt
|
||||
|
||||
machine.screenshot("Repath-Studio-GUI-Welcome")
|
||||
machine.send_key("kp_enter") # OK
|
||||
|
||||
# sleep is required it needs time to dismiss the dialog
|
||||
machine.sleep(2)
|
||||
machine.send_key("ctrl-shift-s")
|
||||
machine.sleep(2)
|
||||
machine.send_chars("/tmp/saved.rps\n")
|
||||
machine.sleep(2)
|
||||
print(machine.succeed("cat /tmp/saved.rps"))
|
||||
assert "${pkgs.repath-studio.version}" in machine.succeed("cat /tmp/saved.rps")
|
||||
|
||||
machine.screenshot("Repath-Studio-GUI")
|
||||
'';
|
||||
|
||||
meta.maintainers = lib.teams.ngi.members;
|
||||
}
|
||||
@@ -17,6 +17,8 @@
|
||||
replaceVars,
|
||||
|
||||
vulkan-loader,
|
||||
|
||||
nixosTests,
|
||||
}:
|
||||
buildNpmPackage (finalAttrs: {
|
||||
pname = "repath-studio";
|
||||
@@ -67,53 +69,6 @@ buildNpmPackage (finalAttrs: {
|
||||
--replace-fail ":shadow-git-inject/version" '"v${finalAttrs.version}"'
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
# this was taken and adapted from "logseq" package's nixpkgs derivation
|
||||
mavenRepo = stdenv.mkDerivation {
|
||||
name = "repath-studio-${finalAttrs.version}-maven-deps";
|
||||
inherit (finalAttrs) src patches;
|
||||
|
||||
nativeBuildInputs = [ clojure ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export HOME="$(mktemp -d)"
|
||||
mkdir -p "$out"
|
||||
|
||||
# -P -> resolve all normal deps
|
||||
# -M:alias -> resolve extra-deps of the listed aliases
|
||||
clj -Sdeps "{:mvn/local-repo \"$out\"}" -P -M:dev:cljs
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
# copied from buildMavenPackage
|
||||
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
find $out -type f \( \
|
||||
-name \*.lastUpdated \
|
||||
-o -name resolver-status.properties \
|
||||
-o -name _remote.repositories \) \
|
||||
-delete
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontFixup = true;
|
||||
|
||||
outputHash = "sha256-ytS7JiQUC7U0vxuQddxQfDnm0Pt4stkRBfiIlbOpeTk=";
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
};
|
||||
|
||||
clojureWithCache = writeShellScriptBin "clojure" ''
|
||||
exec ${lib.getExe' clojure "clojure"} -Sdeps '{:mvn/local-repo "${finalAttrs.passthru.mavenRepo}"}' "$@"
|
||||
'';
|
||||
};
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
@@ -189,7 +144,55 @@ buildNpmPackage (finalAttrs: {
|
||||
})
|
||||
];
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
passthru = {
|
||||
# this was taken and adapted from "logseq" package's nixpkgs derivation
|
||||
mavenRepo = stdenv.mkDerivation {
|
||||
name = "repath-studio-${finalAttrs.version}-maven-deps";
|
||||
inherit (finalAttrs) src patches;
|
||||
|
||||
nativeBuildInputs = [ clojure ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export HOME="$(mktemp -d)"
|
||||
mkdir -p "$out"
|
||||
|
||||
# -P -> resolve all normal deps
|
||||
# -M:alias -> resolve extra-deps of the listed aliases
|
||||
clj -Sdeps "{:mvn/local-repo \"$out\"}" -P -M:dev:cljs
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
# copied from buildMavenPackage
|
||||
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
find $out -type f \( \
|
||||
-name \*.lastUpdated \
|
||||
-o -name resolver-status.properties \
|
||||
-o -name _remote.repositories \) \
|
||||
-delete
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontFixup = true;
|
||||
|
||||
outputHash = "sha256-ytS7JiQUC7U0vxuQddxQfDnm0Pt4stkRBfiIlbOpeTk=";
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
};
|
||||
|
||||
clojureWithCache = writeShellScriptBin "clojure" ''
|
||||
exec ${lib.getExe' clojure "clojure"} -Sdeps '{:mvn/local-repo "${finalAttrs.passthru.mavenRepo}"}' "$@"
|
||||
'';
|
||||
|
||||
updateScript = ./update.sh;
|
||||
tests = { inherit (nixosTests) repath-studio; };
|
||||
};
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/repath-studio/repath-studio/blob/v${finalAttrs.src.rev}/CHANGELOG.md";
|
||||
|
||||
Reference in New Issue
Block a user