This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
{ system, inputs, pkgs, ... }:
|
||||
pkgs.lib.optionalAttrs (system == "x86_64-linux") (let
|
||||
lib = inputs.nixpkgs.lib;
|
||||
revision = "b4c8548c09da21b2898443559a5b846f0ccf5dd8";
|
||||
mkSystem = version: sourceRevision: lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
(import ../../nixos/system/hectic-lab/affine.nix { domain = "example.test"; })
|
||||
{
|
||||
system.stateVersion = "26.05";
|
||||
nixpkgs.overlays = [ (_: _: {
|
||||
hectic.affine-frontend-static = pkgs.runCommand "affine-static-test" {
|
||||
inherit version;
|
||||
passthru.revision = sourceRevision;
|
||||
} ''mkdir -p "$out"'';
|
||||
}) ];
|
||||
}
|
||||
];
|
||||
};
|
||||
cfg = (mkSystem "0.27.4" revision).config;
|
||||
mismatchedCfg = (mkSystem "0.27.5" revision).config;
|
||||
mismatchedRevisionCfg = (mkSystem "0.27.4" "different-source").config;
|
||||
main = cfg.systemd.services.affine;
|
||||
frontend = cfg.systemd.services.affine-frontend;
|
||||
in {
|
||||
affine-frontend-module =
|
||||
assert frontend.requires == [ "affine.service" ];
|
||||
assert frontend.after == [ "affine.service" ];
|
||||
assert frontend.partOf == [ "affine.service" ];
|
||||
assert frontend.reloadIfChanged;
|
||||
assert !frontend.restartIfChanged;
|
||||
assert frontend.serviceConfig.Type == "oneshot";
|
||||
assert frontend.serviceConfig.RemainAfterExit;
|
||||
assert frontend.serviceConfig.ExecStart == frontend.serviceConfig.ExecReload;
|
||||
assert lib.hasInfix "affine-frontend-compose.yaml up --detach --no-deps --force-recreate affine" frontend.serviceConfig.ExecStart;
|
||||
assert frontend.serviceConfig.ExecStop == lib.replaceStrings
|
||||
[ " up --detach --wait" ] [ " up --detach --no-deps --force-recreate affine" ] main.serviceConfig.ExecStart;
|
||||
assert lib.hasSuffix "affine-compose.yaml up --detach --wait" main.serviceConfig.ExecStart;
|
||||
assert lib.hasSuffix "affine-compose.yaml down" main.serviceConfig.ExecStop;
|
||||
assert !lib.hasInfix "affine-frontend-compose.yaml" main.serviceConfig.ExecStart;
|
||||
assert cfg.services.nginx.virtualHosts."affine.example.test".locations."/".proxyPass == "http://127.0.0.1:3010";
|
||||
assert !(cfg.systemd.services ? affine-native);
|
||||
assert lib.any (check:
|
||||
check.message == "AFFiNE frontend assets and the deployed backend image must use the same release." &&
|
||||
!check.assertion
|
||||
) mismatchedCfg.assertions;
|
||||
assert lib.any (check:
|
||||
check.message == "AFFiNE frontend source revision must match the pinned 0.27.4 backend." &&
|
||||
!check.assertion
|
||||
) mismatchedRevisionCfg.assertions;
|
||||
pkgs.runCommand "affine-frontend-module" {} ''touch "$out"'';
|
||||
})
|
||||
@@ -33,7 +33,8 @@ let
|
||||
caseSensitive = false;
|
||||
};
|
||||
}).config;
|
||||
in (import ./affine.nix { inherit system inputs self pkgs; }) // {
|
||||
in (import ./affine.nix { inherit system inputs self pkgs; }) //
|
||||
(import ./affine-frontend.nix { inherit system inputs pkgs; }) // {
|
||||
p4d-module-basic =
|
||||
assert enabledCfg.users.users.p4d.isSystemUser;
|
||||
assert enabledCfg.users.users.p4d.group == "p4d";
|
||||
|
||||
Reference in New Issue
Block a user