summaryrefslogtreecommitdiff
path: root/test/flake.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2024-01-26 05:43:47 -0500
committerseth <[email protected]>2024-01-26 05:43:47 -0500
commit90c83b4694150bdcfe4fcac1c55fcfdef17c3612 (patch)
tree74f3a8d9cac0b972fc7e50fdcf2403f60e39795e /test/flake.nix
initial commit
Diffstat (limited to 'test/flake.nix')
-rw-r--r--test/flake.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/flake.nix b/test/flake.nix
new file mode 100644
index 0000000..bb8ff4c
--- /dev/null
+++ b/test/flake.nix
@@ -0,0 +1,55 @@
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+
+ parts = {
+ url = "github:hercules-ci/flake-parts";
+ inputs.nixpkgs-lib.follows = "nixpkgs";
+ };
+
+ call-flake.url = "github:divnix/call-flake";
+ };
+
+ outputs = inputs:
+ inputs.parts.lib.mkFlake {inherit inputs;} {
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ ];
+
+ imports = [(inputs.call-flake ../.).flakeModule];
+
+ debug = true;
+
+ perSystem = {
+ config,
+ lib,
+ pkgs,
+ ...
+ }: {
+ procfiles.daemons.processes = {
+ redis = lib.getExe' pkgs.redis "redis-server";
+ };
+
+ devShells.default = pkgs.mkShellNoCC {
+ packages = [
+ (pkgs.writeShellScriptBin "run-ci" ''
+ set -x
+
+ exec ${lib.getExe config.procfiles.daemons.package} &
+ sleep 5 # avoid race conditions
+
+ if ! overmind status | grep running; then
+ echo "Processes failed to launch! Exiting with error"
+ overmind kill
+ exit 1
+ fi
+
+ overmind kill
+ echo "Process finished! Exiting as success"
+ '')
+ ];
+ };
+ };
+ };
+}