Compare commits

..

No commits in common. "21f0199791c1dacecefa633db1e1834b06a4dda7" and "a602cf41439d960dd07b8a4bcf3562112b8f02b4" have entirely different histories.

4 changed files with 4 additions and 33 deletions

View file

@ -52,7 +52,6 @@ in
lohr = { lohr = {
enable = true; enable = true;
sharedSecretFile = secrets."lohr/secret".path; sharedSecretFile = secrets."lohr/secret".path;
sshKeyFile = secrets."lohr/ssh-key".path;
}; };
# Matrix backend and Element chat front-end # Matrix backend and Element chat front-end
matrix = { matrix = {

Binary file not shown.

View file

@ -19,7 +19,6 @@ in
"drone/ssh/private-key.age".publicKeys = all; "drone/ssh/private-key.age".publicKeys = all;
"lohr/secret.age".publicKeys = all; "lohr/secret.age".publicKeys = all;
"lohr/ssh-key.age".publicKeys = all;
"matrix/mail.age" = { "matrix/mail.age" = {
owner = "matrix-synapse"; owner = "matrix-synapse";

View file

@ -5,9 +5,6 @@ let
settingsFormat = pkgs.formats.yaml { }; settingsFormat = pkgs.formats.yaml { };
lohrPkg = pkgs.ambroisie.lohr; lohrPkg = pkgs.ambroisie.lohr;
lohrStateDirectory = "lohr";
lohrHome = "/var/lib/lohr/";
in in
{ {
options.my.services.lohr = with lib; { options.my.services.lohr = with lib; {
@ -37,15 +34,6 @@ in
example = "/run/secrets/lohr.env"; example = "/run/secrets/lohr.env";
description = "Shared secret between lohr and Gitea hook"; description = "Shared secret between lohr and Gitea hook";
}; };
sshKeyFile = mkOption {
type = with types; nullOr str;
default = null;
example = "/run/secrets/lohr/ssh-key";
description = ''
The ssh key that should be used by lohr to mirror repositories
'';
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -58,31 +46,16 @@ in
Environment = [ Environment = [
"ROCKET_PORT=${toString cfg.port}" "ROCKET_PORT=${toString cfg.port}"
"ROCKET_LOG_LEVEL=normal" "ROCKET_LOG_LEVEL=normal"
"LOHR_HOME=${lohrHome}" "LOHR_HOME=/var/lib/lohr/"
"LOHR_CONFIG=" "LOHR_CONFIG="
]; ];
ExecStartPre = lib.mkIf (cfg.sshKeyFile != null) ''+${
pkgs.writeScript "copy-ssh-key" ''
#!${pkgs.bash}/bin/bash
# Ensure the key is not there
mkdir -p '${lohrHome}/.ssh'
rm -f '${lohrHome}/.ssh/id_ed25519'
# Move the key into place
cp ${cfg.sshKeyFile} '${lohrHome}/.ssh/id_ed25519'
# Fix permissions
chown -R lohr:lohr '${lohrHome}/.ssh'
chmod -R 0700 '${lohrHome}/.ssh'
''
}'';
ExecStart = ExecStart =
let let
configFile = settingsFormat.generate "lohr-config.yaml" cfg.setting; configFile = settingsFormat.generate "lohr-config.yaml" cfg.setting;
in in
"${lohrPkg}/bin/lohr --config ${configFile}"; "${lohrPkg}/bin/lohr --config ${configFile}";
StateDirectory = lohrStateDirectory; StateDirectory = "lohr";
WorkingDirectory = lohrHome; WorkingDirectory = "/var/lib/lohr";
User = "lohr"; User = "lohr";
Group = "lohr"; Group = "lohr";
}; };
@ -93,7 +66,7 @@ in
users.users.lohr = { users.users.lohr = {
isSystemUser = true; isSystemUser = true;
home = lohrHome; home = "/var/lib/lohr";
createHome = true; createHome = true;
group = "lohr"; group = "lohr";
}; };