Merge 46c029e64411239ccacbc7d257882c716644ac60 into 60861d6af841d96085db366d44c1d543b7659fa5

This commit is contained in:
Arnaud 2025-12-24 06:31:58 +00:00 committed by GitHub
commit dd281ddc89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 19 deletions

View File

@ -26,11 +26,11 @@
};
build = targets: buildTarget.override { inherit targets; };
in rec {
nim-codex = build ["all"];
default = nim-codex;
logos-storage-nim = build ["all"];
default = logos-storage-nim;
});
nixosModules.nim-codex = { config, lib, pkgs, ... }: import ./nix/service.nix {
nixosModules.logos-storage-nim = { config, lib, pkgs, ... }: import ./nix/service.nix {
inherit config lib pkgs self;
circomCompatPkg = circom-compat.packages.${pkgs.system}.default;
};
@ -40,7 +40,7 @@
in {
default = pkgs.mkShell {
inputsFrom = [
packages.${system}.nim-codex
packages.${system}.logos-storage-nim
circom-compat.packages.${system}.default
];
# Not using buildInputs to override fakeGit and fakeCargo.
@ -51,24 +51,24 @@
checks = forAllSystems (system: let
pkgs = pkgsFor.${system};
in {
nim-codex-test = pkgs.nixosTest {
name = "nim-codex-test";
logos-storage-nim-test = pkgs.nixosTest {
name = "logos-storage-nim-test";
nodes = {
server = { config, pkgs, ... }: {
imports = [ self.nixosModules.nim-codex ];
services.nim-codex.enable = true;
services.nim-codex.settings = {
data-dir = "/var/lib/nim-codex-test";
imports = [ self.nixosModules.logos-storage-nim ];
services.logos-storage-nim.enable = true;
services.logos-storage-nim.settings = {
data-dir = "/var/lib/logos-storage-nim-test";
};
systemd.services.nim-codex.serviceConfig.StateDirectory = "nim-codex-test";
systemd.services.logos-storage-nim.serviceConfig.StateDirectory = "logos-storage-nim-test";
};
};
testScript = ''
print("Starting test: nim-codex-test")
print("Starting test: logos-storage-nim-test")
machine.start()
machine.wait_for_unit("nim-codex.service")
machine.succeed("test -d /var/lib/nim-codex-test")
machine.wait_until_succeeds("journalctl -u nim-codex.service | grep 'Started Storage node'", 10)
machine.wait_for_unit("logos-storage-nim.service")
machine.succeed("test -d /var/lib/logos-storage-nim-test")
machine.wait_until_succeeds("journalctl -u logos-storage-nim.service | grep 'Started Storage node'", 10)
'';
};
});

View File

@ -6,7 +6,7 @@ let
in pkgs.fetchFromGitHub {
owner = "nim-lang";
repo = "checksums";
rev = tools.findKeyValue "^ +ChecksumsStableCommit = \"([a-f0-9]+)\"$" sourceFile;
rev = tools.findKeyValue "^ +ChecksumsStableCommit = \"([a-f0-9]+)\".*$" sourceFile;
# WARNING: Requires manual updates when Nim compiler version changes.
hash = "sha256-Bm5iJoT2kAvcTexiLMFBa9oU5gf7d4rWjo3OiN7obWQ=";
hash = "sha256-JZhWqn4SrAgNw/HLzBK0rrj3WzvJ3Tv1nuDMn83KoYY=";
}

View File

@ -9,5 +9,5 @@ in pkgs.fetchFromGitHub {
fetchSubmodules = true;
rev = tools.findKeyValue "^ +NimbleStableCommit = \"([a-f0-9]+)\".+" sourceFile;
# WARNING: Requires manual updates when Nim compiler version changes.
hash = "sha256-Rz48sGUKZEAp+UySla+MlsOfsERekuGKw69Tm11fDz8=";
hash = "sha256-wgzFhModFkwB8st8F5vSkua7dITGGC2cjoDvgkRVZMs=";
}

View File

@ -9,7 +9,12 @@ in {
let
linesFrom = file: splitString "\n" (fileContents file);
matching = regex: lines: map (line: match regex line) lines;
extractMatch = matches: last (flatten (remove null matches));
extractMatch = matches:
let xs = flatten (remove null matches);
in if xs == [] then
throw "findKeyValue: no match for regex '${regex}' in ${toString sourceFile}"
else
last xs;
in
extractMatch (matching regex (linesFrom sourceFile));
}