From 5684d1a214c2bd1c34fc314f7a4bd3265dd8b4c8 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Tue, 19 Nov 2024 10:18:15 -0800 Subject: [PATCH] nixos: simplify migrate service by using IHP_MIGRATION_DIR --- NixSupport/nixosModules/services/migrate.nix | 31 +++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/NixSupport/nixosModules/services/migrate.nix b/NixSupport/nixosModules/services/migrate.nix index a5f6d9ad5..f1097193c 100644 --- a/NixSupport/nixosModules/services/migrate.nix +++ b/NixSupport/nixosModules/services/migrate.nix @@ -2,26 +2,15 @@ let cfg = config.services.ihp; in { - systemd.services.migrate = - let migrateApp = pkgs.stdenv.mkDerivation { - name = "migrate-app"; - src = cfg.migrations; - buildPhase = '' - mkdir -p $out/Application/Migration - find "$src" -mindepth 1 -type f -exec cp {} $out/Application/Migration \; - ''; - }; - in { - serviceConfig = { - Type = "oneshot"; - }; - script = '' - cd ${migrateApp} - ${ihp.apps."${pkgs.system}".migrate.program} - ''; - environment = { - DATABASE_URL = cfg.databaseUrl; - MINIMUM_REVISION = "${toString cfg.minimumRevision}"; - }; + systemd.services.migrate = { + serviceConfig = { + Type = "oneshot"; + ExecStart = ihp.apps."${pkgs.system}".migrate.program; + }; + environment = { + DATABASE_URL = cfg.databaseUrl; + MINIMUM_REVISION = "${toString cfg.minimumRevision}"; + IHP_MIGRATION_DIR = cfg.migrations; + }; }; } \ No newline at end of file