Commit af87c194 authored by nikstur's avatar nikstur
Browse files

nixos/yggdrasil: replace activationScript

Replace with separate service because it cannot be moved into the
preStart of the yggdrasil service.
parent 9b29bc00
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -137,7 +137,14 @@ in
        message = "networking.enableIPv6 must be true for yggdrasil to work";
      }];

      system.activationScripts.yggdrasil = mkIf cfg.persistentKeys ''
      # This needs to be a separate service. The yggdrasil service fails if
      # this is put into its preStart.
      systemd.services.yggdrasil-persistent-keys = lib.mkIf cfg.persistentKeys {
        wantedBy = [ "multi-user.target" ];
        before = [ "yggdrasil.service" ];
        serviceConfig.Type = "oneshot";
        serviceConfig.RemainAfterExit = true;
        script = ''
          if [ ! -e ${keysPath} ]
          then
            mkdir --mode=700 -p ${builtins.dirOf keysPath}
@@ -147,6 +154,7 @@ in
              > ${keysPath}
          fi
        '';
      };

      systemd.services.yggdrasil = {
        description = "Yggdrasil Network Service";