From d3b4c730a0d7ebb77e54062d0d8f3dadf4a03ded Mon Sep 17 00:00:00 2001 From: Xe Date: Sun, 26 Dec 2021 13:00:25 -0500 Subject: [PATCH] i can't get this test working Signed-off-by: Xe --- flake.lock | 44 +++++++++++++++++++++++++++++++++++++++----- flake.nix | 22 ++++++++++++---------- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index cb3fc51..14ae1d3 100644 --- a/flake.lock +++ b/flake.lock @@ -61,6 +61,22 @@ "type": "indirect" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1640319671, + "narHash": "sha256-ZkKmakwaOaLiZOpIZWbeJZwap5CzJ30s4UJTfydYIYc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "eac07edbd20ed4908b98790ba299250b5527ecdf", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", @@ -69,14 +85,32 @@ "xess": "xess" } }, - "xess": { - "flake": false, + "utils": { "locked": { - "lastModified": 1637634344, - "narHash": "sha256-63zWhmRpppLzh+H70gHSViHfZ4JvtnOFDRrrjkXtzJE=", + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "xess": { + "inputs": { + "nixpkgs": "nixpkgs_3", + "utils": "utils" + }, + "locked": { + "lastModified": 1640540322, + "narHash": "sha256-II4raADUWKTLDAALyJSToAgL8FB1ADbRHqEr/b3JeIc=", "owner": "Xe", "repo": "Xess", - "rev": "f9ffc529fca9751afdce2408089c51e73d56fce8", + "rev": "5fabc96de6487a721235c4bdf18214519d9e6201", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c0407d5..8e2fe6f 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ }; outputs = { self, nixpkgs, flake-utils, naersk, xess }: - flake-utils.lib.eachDefaultSystem (system: + flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system: let pkgs = nixpkgs.legacyPackages."${system}"; naersk-lib = naersk.lib."${system}"; @@ -31,7 +31,9 @@ cp -rf $src/templates $out/templates cp -rf ${printerfacts-bin}/bin $out/bin - cp -rf ${xess}/xess.css $out/static/gruvbox.css + cp -rf ${ + xess.defaultPackage."${system}" + }/static/css/xess.css $out/static/gruvbox.css ''; }; }; @@ -83,12 +85,11 @@ within.services.printerfacts.enable = true; }; - testScript = - '' - start_all() - client.wait_for_unit("within.printerfacts.service") - client.succeed("curl -f http://printerfacts.akua --resolve printerfacts.akua:80:127.0.0.1") - ''; + testScript = '' + start_all() + server.wait_for_unit("within.printerfacts.service") + server.succeed("sleep 2 && curl -m 2 -v -f http://printerfacts.akua/metrics --unix-socket /srv/within/run/printerfacts.sock") + ''; }; nixosModules.printerfacts = { config, lib, pkgs, ... }: @@ -124,11 +125,12 @@ DynamicUser = "yes"; Restart = "on-failure"; WorkingDirectory = "/srv/within/printerfacts"; - RestartSec = "30s"; + RestartSec = "5s"; }; script = let site = self.packages."${system}".printerfacts; in '' + set -x export SOCKPATH=${cfg.sockPath} export DOMAIN=${toString cfg.domain} export RUST_LOG=info @@ -146,7 +148,7 @@ proxyWebsockets = true; }; forceSSL = cfg.useACME; - useACMEHost = "cetacean.club"; + useACMEHost = mkIf cfg.useACME "cetacean.club"; extraConfig = '' access_log /var/log/nginx/printerfacts.access.log; '';