Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Guide/deployment.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ flake.nixosConfigurations."ihp-app" = nixpkgs.lib.nixosSystem {

services.ihp = {
domain = "myihpapp.com";
migrations = ./Application/Migration;
migrations = ./Application/Migration; # Optional: Remove this line or set to null if you don't use migrations
schema = ./Application/Schema.sql;
fixtures = ./Application/Fixtures.sql;
sessionSecret = "xxx";
Expand Down Expand Up @@ -282,7 +282,7 @@ Make sure you put this into the `flake-parts.lib.mkFlake` block. The final `flak
+
+ services.ihp = {
+ domain = "myihpapp.com";
+ migrations = ./Application/Migration;
+ migrations = ./Application/Migration; # Optional: Remove this line or set to null if you don't use migrations
+ schema = ./Application/Schema.sql;
+ fixtures = ./Application/Fixtures.sql;
+ sessionSecret = "xxx";
Expand Down
6 changes: 5 additions & 1 deletion NixSupport/nixosModules/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ with lib;
};

migrations = mkOption {
type = types.path;
type = types.nullOr types.path;
default = null;
description = ''
Path to the migrations directory. If null, migrations will be skipped.
'';
};

schema = mkOption {
Expand Down
4 changes: 2 additions & 2 deletions NixSupport/nixosModules/services/migrate.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{ config, pkgs, ihp, ... }:
{ config, pkgs, lib, ihp, ... }:
let cfg = config.services.ihp;
in
{
systemd.services.migrate = {
systemd.services.migrate = lib.mkIf (cfg.migrations != null) {
serviceConfig = {
Type = "oneshot";
ExecStart = ihp.apps."${pkgs.system}".migrate.program;
Expand Down
6 changes: 5 additions & 1 deletion flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,11 @@ ihpFlake:
--option sandbox false \
--option extra-substituters "https://digitallyinduced.cachix.org" \
--option extra-trusted-public-keys "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE="
ssh $1 systemctl start migrate

# Only start migrate service if it exists
if ssh $1 systemctl list-unit-files migrate.service >/dev/null 2>&1; then
ssh $1 systemctl start migrate
fi
'';

overlays = [ihp.overlays.default];
Expand Down