nix run .#query-all-services

master
Alexander Tomokhov 2023-12-12 07:21:30 +04:00
parent ba7c20d1f8
commit 08a5dd0870
4 changed files with 104 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/result

26
flake.lock Normal file
View File

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1696983906,
"narHash": "sha256-L7GyeErguS7Pg4h8nK0wGlcUTbfUMDu+HMf1UcyP72k=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "bd1cde45c77891214131cbbea5b1203e485a9d51",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

75
flake.nix Normal file
View File

@ -0,0 +1,75 @@
{
description = "Tests for SelfPrivacy";
inputs.nixpkgs.url = github:nixos/nixpkgs;
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
# Generate a user-friendly version number. TODO
version = (builtins.substring 0 8 self.lastModifiedDate) + self.shortRev;
in
{
packages.${system}.query-all-services =
pkgs.runCommandLocal "query-all-services"
{
nativeBuildInputs = [ pkgs.makeWrapper ];
} ''
ls -l
install -m755 ${./query-all-services.sh} \
-D $out/bin/query-all-services
patchShebangs $out/bin/query-all-services
wrapProgram $out/bin/query-all-services \
--prefix PATH : ${with pkgs; lib.makeBinPath [
curl
diffutils
gzip
jd-diff-patch
jq
openssh
gnutar
]}
'';
# packages.${system}.query-all-services =
# pkgs.writeShellApplication {
# name = "query-all-services.sh";
# checkPhase = true;
# text =./query-all-services.sh;
# runtimeInputs = with pkgs; [
# curl
# diffutils
# gzip
# jd-diff-patch
# jq
# openssh
# gnutar
# ];
# };
# packages.${system}.query-all-services =
# pkgs.resholve.writeScriptBin "query-all-services.sh" {
# inputs = with pkgs; [
# curl
# diffutils
# gzip
# jd-diff-patch
# jq
# openssh
# gnutar
# ];
# interpreter = "${pkgs.bash}/bin/bash";
# } ./query-all-services.sh;
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
curl
diffutils
gzip
jd-diff-patch
jq
openssh
gnutar
];
};
};
}

View File

@ -78,7 +78,8 @@ EOF
)
readonly EXPECTED_RESPONSE
received_response="$(curl -s "https://api.$DOMAIN/graphql" --compressed \
received_response="$(curl --show-error -s "https://api.$DOMAIN/graphql" \
--compressed \
-H 'Content-Type: application/json' \
--data-raw "$REQUEST" -k -H "$AUTH_HEADER" | jq --sort-keys)"
@ -90,4 +91,3 @@ else
echo -e "\e[1;31mFAIL: response does not match!"
exit 1
fi