Add module with tatoeba service definition

main
Elnu 1 year ago
parent 842b6f92dc
commit e90adfaf87

@ -50,5 +50,37 @@
};
});
};
nixosModules.default = { config, ... }: let
lib = nixpkgs.lib;
in {
options.services.tatoeba = {
enable = lib.mkEnableOption (lib.mdDoc "tatoeba service");
package = lib.mkOption {
type = lib.types.package;
default = self.packages.${system}.tatoeba;
defaultText = "pkgs.tatoeba";
description = lib.mdDoc ''
The tatoeba package that should be used.
'';
};
};
config = {
systemd.services.tatoeba = let
cfg = config.services.tatoeba;
pkg = self.packages.${system}.tatoeba;
in lib.mkIf cfg.enable {
description = pkg.meta.description;
after = [ "network.target" ];
wantedBy = [ "network.target" ];
serviceConfig = {
ExecStart = ''
${cfg.package}/bin/tatoeba
'';
Restart = "always";
DynamicUser = true;
};
};
};
};
};
}

Loading…
Cancel
Save