nixpkgs/nixos/modules/services/networking/freenet.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.2 KiB
Nix
Raw Normal View History

2013-04-22 13:50:58 +00:00
# NixOS module for Freenet daemon
{ config, lib, pkgs, ... }:
2013-04-21 07:27:41 +00:00
let
cfg = config.services.freenet;
varDir = "/var/lib/freenet";
in
{
### configuration
options = {
services.freenet = {
enable = lib.mkOption {
type = lib.types.bool;
2013-04-21 07:27:41 +00:00
default = false;
description = "Enable the Freenet daemon";
};
nice = lib.mkOption {
type = lib.types.int;
2013-04-21 07:27:41 +00:00
default = 10;
description = "Set the nice level for the Freenet daemon";
};
};
};
### implementation
config = lib.mkIf cfg.enable {
2013-04-21 07:27:41 +00:00
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;
};
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;
uid = config.ids.uids.freenet;
2013-04-21 07:27:41 +00:00
};
users.groups.freenet.gid = config.ids.gids.freenet;
2013-04-21 07:27:41 +00:00
};
}