diff options
author | nikstur <nikstur@outlook.com> | 2023-10-29 00:50:27 +0200 |
---|---|---|
committer | nikstur <nikstur@outlook.com> | 2023-12-29 03:22:27 +0100 |
commit | af87c19427b9704eb77b5db080c3c117b00de589 (patch) | |
tree | f5e70f2a4e94b7f726b3958a35f32e948d151948 /nixos/modules/services/networking/yggdrasil.nix | |
parent | 9b29bc0010a9cee3236511f70f36b8ae95887f5c (diff) | |
download | nixlib-af87c19427b9704eb77b5db080c3c117b00de589.tar nixlib-af87c19427b9704eb77b5db080c3c117b00de589.tar.gz nixlib-af87c19427b9704eb77b5db080c3c117b00de589.tar.bz2 nixlib-af87c19427b9704eb77b5db080c3c117b00de589.tar.lz nixlib-af87c19427b9704eb77b5db080c3c117b00de589.tar.xz nixlib-af87c19427b9704eb77b5db080c3c117b00de589.tar.zst nixlib-af87c19427b9704eb77b5db080c3c117b00de589.zip |
nixos/yggdrasil: replace activationScript
Replace with separate service because it cannot be moved into the preStart of the yggdrasil service.
Diffstat (limited to 'nixos/modules/services/networking/yggdrasil.nix')
-rw-r--r-- | nixos/modules/services/networking/yggdrasil.nix | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/nixos/modules/services/networking/yggdrasil.nix b/nixos/modules/services/networking/yggdrasil.nix index 514753687d69..9173e7eb3457 100644 --- a/nixos/modules/services/networking/yggdrasil.nix +++ b/nixos/modules/services/networking/yggdrasil.nix @@ -137,16 +137,24 @@ in message = "networking.enableIPv6 must be true for yggdrasil to work"; }]; - system.activationScripts.yggdrasil = mkIf cfg.persistentKeys '' - if [ ! -e ${keysPath} ] - then - mkdir --mode=700 -p ${builtins.dirOf keysPath} - ${binYggdrasil} -genconf -json \ - | ${pkgs.jq}/bin/jq \ - 'to_entries|map(select(.key|endswith("Key")))|from_entries' \ - > ${keysPath} - fi - ''; + # 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} + ${binYggdrasil} -genconf -json \ + | ${pkgs.jq}/bin/jq \ + 'to_entries|map(select(.key|endswith("Key")))|from_entries' \ + > ${keysPath} + fi + ''; + }; systemd.services.yggdrasil = { description = "Yggdrasil Network Service"; |