generated from ElnuDev/rust-project
Add module with tatoeba service definition
This commit is contained in:
parent
842b6f92dc
commit
e90adfaf87
1 changed files with 32 additions and 0 deletions
32
flake.nix
32
flake.nix
|
@ -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…
Add table
Reference in a new issue