From 1ef4c1cd48dfd149adcd3cad03a7dad3521c0339 Mon Sep 17 00:00:00 2001 From: echtnurich Date: Mon, 5 Aug 2024 20:58:09 +0200 Subject: [PATCH] Fix config via git --- config/hosts/yate/configuration.nix | 2 ++ config/hosts/yate/service.nix | 17 +++++++++++------ config/hosts/yate/yate.nix | 8 ++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/config/hosts/yate/configuration.nix b/config/hosts/yate/configuration.nix index 6b4bb71..1ba7fc9 100644 --- a/config/hosts/yate/configuration.nix +++ b/config/hosts/yate/configuration.nix @@ -6,5 +6,7 @@ domain = "z9.ccchh.net"; }; + users.users.chaos.password = "yes"; + system.stateVersion = "23.11"; } diff --git a/config/hosts/yate/service.nix b/config/hosts/yate/service.nix index 8c0eb50..337ddfc 100644 --- a/config/hosts/yate/service.nix +++ b/config/hosts/yate/service.nix @@ -12,17 +12,22 @@ ExecStart = "${pkgs.yate}/bin/yate -c /etc/yate -e /etc/yate/share -Do"; Type="simple"; Restart="always"; + Group="yate-config"; + StateDirectory = "yate"; + StateDirectoryMode = "0775"; # ... }; wantedBy = [ "default.target" ]; requiredBy = [ "network.target" ]; - preStart = "if mkdir -p /etc/yate + preStart = "if ! [ -d \"/var/lib/yate/.git\" ] then - ${pkgs.git}/bin/git -C /etc/yate clone forgejo@git.hamburg.ccc.de:echtnurich/yate-config.git - ${pkgs.git}/bin/git -C /etc/yate pull - else - ${pkgs.git}/bin/git -C /etc/yate checkout -f origin/main - fi"; + ${pkgs.git}/bin/git init /var/lib/yate + ${pkgs.git}/bin/git -C /var/lib/yate remote add origin forgejo@git.hamburg.ccc.de:echtnurich/yate-config.git + ${pkgs.git}/bin/git -C /var/lib/yate pull -f --set-upstream + echo \"New repo set up.\" + fi + ${pkgs.git}/bin/git -C /var/lib/yate fetch --all + ${pkgs.git}/bin/git -C /var/lib/yate checkout --track -f origin/master"; # ... }; } diff --git a/config/hosts/yate/yate.nix b/config/hosts/yate/yate.nix index c4834bb..f72da0f 100644 --- a/config/hosts/yate/yate.nix +++ b/config/hosts/yate/yate.nix @@ -10,4 +10,12 @@ # Just disable it for now. networking.firewall.enable = false; + + users.groups.yate-config = {}; + users.groups.yate-config.members = [ "colmema-deploy" "chaos" ]; + + environment.etc.yate.user = "root"; + environment.etc.yate.group = "yate-config"; + environment.etc.yate.mode = "0775"; + environment.etc.yate.source = "/var/lib/yate"; }