Add module with images service definition

main
Elnu 1 year ago
parent 7591109e50
commit 138bc69590

@ -58,6 +58,7 @@
nixosModules.default = { config, ... }: let
lib = nixpkgs.lib;
in {
# tatoeba
options.services.tatoeba = {
enable = lib.mkEnableOption (lib.mdDoc "tatoeba service");
package = lib.mkOption {
@ -76,8 +77,7 @@
'';
};
};
config = {
systemd.services.tatoeba = let
config.systemd.services.tatoeba = let
cfg = config.services.tatoeba;
pkg = self.packages.${system}.tatoeba;
in lib.mkIf cfg.enable {
@ -92,6 +92,40 @@
DynamicUser = true;
};
};
# images
options.services.images = {
enable = lib.mkEnableOption (lib.mdDoc "images service");
package = lib.mkOption {
type = lib.types.package;
default = self.packages.${system}.images;
defaultText = "pkgs.images";
description = lib.mdDoc ''
The images package that should be used.
'';
};
port = lib.mkOption {
type = lib.types.port;
default = 3002;
description = lib.mdDoc ''
The port at which to run.
'';
};
};
config.systemd.services.images = let
cfg = config.services.images;
pkg = self.packages.${system}.images;
in lib.mkIf cfg.enable {
description = pkg.meta.description;
after = [ "network.target" ];
wantedBy = [ "network.target" ];
serviceConfig = {
ExecStart = ''
${cfg.package}/bin/images --port ${builtins.toString cfg.port}
'';
Restart = "always";
DynamicUser = true;
};
};
};
};

Loading…
Cancel
Save