generated from ElnuDev/rust-project
Add module with images service definition
This commit is contained in:
parent
7591109e50
commit
138bc69590
1 changed files with 49 additions and 15 deletions
64
flake.nix
64
flake.nix
|
@ -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,21 +77,54 @@
|
|||
'';
|
||||
};
|
||||
};
|
||||
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 --port ${builtins.toString cfg.port}
|
||||
'';
|
||||
Restart = "always";
|
||||
DynamicUser = true;
|
||||
};
|
||||
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 --port ${builtins.toString cfg.port}
|
||||
'';
|
||||
Restart = "always";
|
||||
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…
Add table
Reference in a new issue