2013-04-22 13:50:58 +00:00
|
|
|
# NixOS module for Freenet daemon
|
2013-04-21 07:27:41 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2013-04-21 07:27:41 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2013-04-21 07:27:41 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.freenet;
|
|
|
|
varDir = "/var/lib/freenet";
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
### configuration
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.freenet = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
2015-06-15 16:10:26 +00:00
|
|
|
type = types.bool;
|
2013-04-21 07:27:41 +00:00
|
|
|
default = false;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc "Enable the Freenet daemon";
|
2013-04-21 07:27:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nice = mkOption {
|
2015-06-15 16:11:32 +00:00
|
|
|
type = types.int;
|
2013-04-21 07:27:41 +00:00
|
|
|
default = 10;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc "Set the nice level for the Freenet daemon";
|
2013-04-21 07:27:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
systemd.services.freenet = {
|
|
|
|
description = "Freenet daemon";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig.ExecStart = "${pkgs.freenet}/bin/freenet";
|
|
|
|
serviceConfig.User = "freenet";
|
|
|
|
serviceConfig.UMask = "0007";
|
|
|
|
serviceConfig.WorkingDirectory = varDir;
|
|
|
|
serviceConfig.Nice = cfg.nice;
|
|
|
|
};
|
|
|
|
|
2018-06-29 23:58:35 +00:00
|
|
|
users.users.freenet = {
|
2013-04-21 07:27:41 +00:00
|
|
|
group = "freenet";
|
2013-04-22 13:50:58 +00:00
|
|
|
description = "Freenet daemon user";
|
2013-04-21 07:27:41 +00:00
|
|
|
home = varDir;
|
|
|
|
createHome = true;
|
2013-08-23 09:33:24 +00:00
|
|
|
uid = config.ids.uids.freenet;
|
2013-04-21 07:27:41 +00:00
|
|
|
};
|
|
|
|
|
2018-06-29 23:58:35 +00:00
|
|
|
users.groups.freenet.gid = config.ids.gids.freenet;
|
2013-04-21 07:27:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|