about summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-05-24 12:58:15 +0300
committerVika <vika@fireburn.ru>2022-05-24 16:30:43 +0300
commitd0057b822858e5d31d0b80d61ec555dea9b71ace (patch)
treeaa9c6a39e1a6394b9f352b26e484adbae09122e2 /flake.nix
parent7d25e1ed45c05c64c8783bb72f1f62e166b69783 (diff)
flake.nix: make a test for distributed Kittybox
I said some boastful words about Kittybox being able to horizontally
scale and I wanted to prove them. This is the proof.

This test creates an NFS file server, then spawns three
VMs. Provisioning a website on one of them, it then queries the
website on all of the three machines. This shows that a shared backing
store can make Kittybox infinitely scale horizontally depending on how
much traffic you're getting.
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix20
1 files changed, 16 insertions, 4 deletions
diff --git a/flake.nix b/flake.nix
index 900d879..4de70c6 100644
--- a/flake.nix
+++ b/flake.nix
@@ -187,12 +187,25 @@
     };
     rust-bin = pkgs.rust-bin.stable.latest;
     packages = {
-      kittybox = { stdenv, lib, openssl, zlib, pkg-config, protobuf, naersk-lib, lld, mold }:
+      kittybox = { stdenv, lib, runCommandNoCC, openssl, zlib, pkg-config, protobuf, naersk-lib, lld, mold }:
       naersk-lib.buildPackage {
         pname = "kittybox";
         version = "0.1.0";
 
-        src = ./.;
+        /*src = builtins.filterSource (name: type: builtins.elem (builtins.elemAt (lib.splitString "/" name) 4) [
+          "Cargo.toml" "Cargo.lock"
+          "src" "templates" "util"
+          "fonts"
+        ]) ./.;*/
+        src = runCommandNoCC "kittybox-src" {} ''
+          mkdir -p $out
+          cp -r ${./Cargo.toml} $out/Cargo.toml
+          cp -r ${./Cargo.lock} $out/Cargo.lock
+          cp -r ${./src} $out/src
+          cp -r ${./templates} $out/templates
+          cp -r ${./util} $out/util
+          cp -r ${./fonts} $out/fonts
+        '';
 
         checkInputs = [ openssl.dev zlib ];
         nativeBuildInputs = [ pkg-config protobuf ];
@@ -200,8 +213,6 @@
 
         doCheck = stdenv.hostPlatform == stdenv.targetPlatform;
 
-        singleStep = true;
-
         meta = with lib.meta; {
           maintainers = with lib.maintainers; [ vikanezrimaya ];
           platforms = supportedSystems;
@@ -221,6 +232,7 @@
 
     checks = {
       kittybox = self.packages.${system}.kittybox;
+      distributed-test = pkgs.nixosTest (import ./distributed-test.nix self);
       nixos-test = (pkgs.nixosTest ({ lib }: {
         name = "nixos-kittybox";