Skip to content

Commit

Permalink
fix: restart opnix on nixos-rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjones2014 committed Aug 15, 2024
1 parent 790e1af commit 40e141a
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions modules/op-secrets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ in {
example = [ "homepage-dashboard" "wg-quick-vpn" ];
};
};
config = mkIf (cfg.secrets != { }) (mkMerge [
config = let
opnixScript = ''
${scripts.installSecrets}
${scripts.chownSecrets}
'';
in mkIf (cfg.secrets != { }) (mkMerge [
{
systemd.services.opnix = {
wants = [ "network-online.target" ];
Expand All @@ -74,13 +79,19 @@ in {
serviceConfig = {
Type = "oneshot";
EnvironmentFile = cfg.environmentFile;
Restart = "always";
};

script = ''
${scripts.installSecrets}
${scripts.chownSecrets}
'';
script = opnixScript;
};

systemd.services.opnix-restart = {
wants = [ "network-online.target" ];
after = [ "sysinit-reactivation.target" ];
serviceConfig = {
Type = "oneshot";
EnvironmentFile = cfg.environmentFile;
};
script = opnixScript;
};
}
{
Expand Down

0 comments on commit 40e141a

Please sign in to comment.