mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/freenet: refactor
This commit is contained in:
parent
699c1f4c7a
commit
0604d0aedd
1 changed files with 10 additions and 24 deletions
|
@ -1,54 +1,39 @@
|
|||
# NixOS module for Freenet daemon
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
let
|
||||
cfg = config.services.freenet;
|
||||
varDir = "/var/lib/freenet";
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
|
||||
### configuration
|
||||
|
||||
options = {
|
||||
|
||||
services.freenet = {
|
||||
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable the Freenet daemon";
|
||||
};
|
||||
enable = lib.mkEnableOption "Freenet daemon";
|
||||
|
||||
nice = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 10;
|
||||
description = "Set the nice level for the Freenet daemon";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
### implementation
|
||||
|
||||
config = lib.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;
|
||||
serviceConfig = {
|
||||
ExecStart = lib.getExe pkgs.freenet;
|
||||
User = "freenet";
|
||||
UMask = "0007";
|
||||
WorkingDirectory = varDir;
|
||||
Nice = cfg.nice;
|
||||
};
|
||||
};
|
||||
|
||||
users.users.freenet = {
|
||||
|
@ -62,4 +47,5 @@ in
|
|||
users.groups.freenet.gid = config.ids.gids.freenet;
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ nagy ];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue