From b42958456a1460a59512a7776277b21c90ee9e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20N=C3=BCtzi?= Date: Tue, 13 Oct 2026 11:29:48 +0200 Subject: [PATCH] fix: update process-compose-flake and service-flake --- .github/actions/setup-nix/action.yaml | 4 + tools/nix/flake.lock | 12 +-- tools/nix/lib/service/authentik/service.nix | 6 +- tools/nix/lib/service/mailhog.nix | 98 --------------------- tools/nix/lib/service/service.parts.nix | 1 - tools/nix/services/test.parts.nix | 14 +-- 6 files changed, 22 insertions(+), 113 deletions(-) delete mode 100644 tools/nix/lib/service/mailhog.nix diff --git a/.github/actions/setup-nix/action.yaml b/.github/actions/setup-nix/action.yaml index eecb88c5..37b4e357 100644 --- a/.github/actions/setup-nix/action.yaml +++ b/.github/actions/setup-nix/action.yaml @@ -15,10 +15,14 @@ runs: - uses: cachix/install-nix-action@v31 with: nix_path: nixpkgs=channel:nixos-unstable + - uses: cachix/cachix-action@v17 with: name: "${{ inputs.cachix_cache_name }}" authToken: "${{ inputs.cachix_auth_token }}" + + - uses: Mic92/hestia@v3 + - name: bootstrap run: nix profile install "./tools/nix#bootstrap" shell: bash diff --git a/tools/nix/flake.lock b/tools/nix/flake.lock index 5121f99a..38434103 100644 --- a/tools/nix/flake.lock +++ b/tools/nix/flake.lock @@ -2077,11 +2077,11 @@ }, "process-compose-flake": { "locked": { - "lastModified": 1782060835, - "narHash": "sha256-Q8HH2t1l3MITtWCWY4ytcH5F/Q7aAHo3Iq/QTMAKTe0=", + "lastModified": 1791313691, + "narHash": "sha256-9Bp/38NrvbjUGZAZTUiYWfbXW/y6B1rSBJHEgRsDK4g=", "owner": "Platonic-Systems", "repo": "process-compose-flake", - "rev": "464ff6880737f063c3f0d3d2c7781fda9190868f", + "rev": "142d4b084026e91d9ab5822639d308aca5fb1b2b", "type": "github" }, "original": { @@ -2271,11 +2271,11 @@ }, "services-flake": { "locked": { - "lastModified": 1783213527, - "narHash": "sha256-yIVKacNpTvEY+xQf2MzNn6jerRrazrkXxTwmwTK4N7M=", + "lastModified": 1791686455, + "narHash": "sha256-D43SS5iVt566m3pqWyg/CjFN7UJ+9rDV87UPwDp7Urw=", "owner": "juspay", "repo": "services-flake", - "rev": "1c9142a3d74abc53aed62687106ee15e873dc3ff", + "rev": "5fb53bb08bdcc2348cb55414275ef94ff7f8dd14", "type": "github" }, "original": { diff --git a/tools/nix/lib/service/authentik/service.nix b/tools/nix/lib/service/authentik/service.nix index 4a46e710..f7769955 100644 --- a/tools/nix/lib/service/authentik/service.nix +++ b/tools/nix/lib/service/authentik/service.nix @@ -248,9 +248,9 @@ in "${name}-pg-db" = { enable = cfg.enable; port = cfg.postgres.port; - initialScript.before = '' - CREATE USER \"${cfg.postgres.user}\" WITH PASSWORD '${cfg.postgres.password}' CREATEDB; - CREATE DATABASE \"${cfg.postgres.name}\" OWNER \"${cfg.postgres.user}\" + initialScript.before = pkgs.writeText "before.sql" '' + CREATE USER "${cfg.postgres.user}" WITH PASSWORD '${cfg.postgres.password}' CREATEDB; + CREATE DATABASE "${cfg.postgres.name}" OWNER '${cfg.postgres.user}' ''; }; }; diff --git a/tools/nix/lib/service/mailhog.nix b/tools/nix/lib/service/mailhog.nix deleted file mode 100644 index 7ba126c0..00000000 --- a/tools/nix/lib/service/mailhog.nix +++ /dev/null @@ -1,98 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: - -let - cfg = config.services.mailhog; - types = lib.types; -in -{ - options.services.mailhog = { - enable = lib.mkEnableOption "mailhog"; - - package = lib.mkOption { - type = types.package; - description = "Which package of mailhog to use"; - default = pkgs.mailhog; - defaultText = lib.literalExpression "pkgs.mailhog"; - }; - - api = { - host = lib.mkOption { - type = types.str; - description = "Host name for the API."; - default = "127.0.0.1"; - }; - port = lib.mkOption { - type = types.number; - description = "Port for the API."; - default = 8025; - }; - }; - - ui = { - host = lib.mkOption { - type = types.str; - description = "Host name for the UI."; - default = "127.0.0.1"; - }; - port = lib.mkOption { - type = types.number; - description = "Port for the UI."; - default = 8025; - }; - }; - - smtp = { - host = lib.mkOption { - type = types.str; - description = "Host name for SMTP."; - default = "127.0.0.1"; - }; - port = lib.mkOption { - type = types.number; - description = "Port for the SMTP."; - default = 1025; - }; - }; - - additionalArgs = lib.mkOption { - type = types.listOf types.lines; - default = [ ]; - example = [ "-invite-jim" ]; - description = '' - Additional arguments passed to `mailhog`. - ''; - }; - }; - - config = { - settings.processes.mailhog = { - command = - # Bash - '' - exec ${lib.getExe cfg.package} \ - -api-bind-addr '${cfg.api.host}:${toString cfg.api.port}' \ - -ui-bind-addr '${cfg.ui.host}:${toString cfg.ui.port}' \ - -smtp-bind-addr '${cfg.smtp.host}:${toString cfg.smtp.port}' \ - ${lib.concatStringsSep " " cfg.additionalArgs} - ''; - - readiness_probe = { - http_get = { - host = cfg.api.host; - port = cfg.api.port; - path = "/api/v2/messages"; - }; - initial_delay_seconds = 1; - period_seconds = 2; - timeout_seconds = 2; - success_threshold = 1; - failure_threshold = 10; - }; - }; - }; -} diff --git a/tools/nix/lib/service/service.parts.nix b/tools/nix/lib/service/service.parts.nix index a87a805c..35ff785f 100644 --- a/tools/nix/lib/service/service.parts.nix +++ b/tools/nix/lib/service/service.parts.nix @@ -10,7 +10,6 @@ flake.processComposeModules = { keycloak = import ./keycloak.nix; authentik = import ./authentik.nix; - mailhog = import ./mailhog.nix; rustfs = import ./rustfs.nix; kms = import ./kms.nix; diff --git a/tools/nix/services/test.parts.nix b/tools/nix/services/test.parts.nix index d6c55915..fe6a3f0c 100644 --- a/tools/nix/services/test.parts.nix +++ b/tools/nix/services/test.parts.nix @@ -49,7 +49,6 @@ self.processComposeModules.keycloak self.processComposeModules.authentik self.processComposeModules.rustfs - self.processComposeModules.mailhog self.processComposeModules.kms ]; @@ -134,7 +133,7 @@ }; }; - services.mailhog = { + services.mailhog."mailhog" = { smtp.port = 1026; enable = true; }; @@ -171,19 +170,20 @@ services.kms = { enable = true; - package = if nix then self'.packages.kms-service else (pkgs.writeShellScriptBin "kms-service" '' - just nix::develop "default" just run + just nix::develop "default-nogh" just run ''); }; settings.processes.kms = { working_dir = "./components/kms"; - # watch = { + # In ProcessCompose-Flake 1.122 its possible to do + # See: https://github.com/Platonic-Systems/process-compose-flake/pull/115 + # watch = lib.optionalAttrs !nix { # debounce = "300ms"; # paths = [ # { @@ -201,11 +201,15 @@ in { + # This test-services are with modos components running from `just run` + # instead of a Nix derivation. # Note: This `test-services-*` package is exposed on `packages` outputs in the flake. process-compose."test-services" = makeServices { nix = false; }; + # This test-services are with all Nix derivations. process-compose."test-services-nix" = makeServices { nix = true; }; modos.services.config = { + # Expose to further inspect. test-services = config.process-compose.test-services; }; };