m 3 udpt: init

This commit is contained in:
makefu 2016-08-21 11:53:58 +02:00
parent a20c72f588
commit 96f862ced4
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225
2 changed files with 60 additions and 1 deletions

View File

@ -2,13 +2,15 @@ _:
{ {
imports = [ imports = [
./populate.nix
./awesome-extra.nix ./awesome-extra.nix
./deluge.nix
./forward-journal.nix ./forward-journal.nix
./ps3netsrv.nix ./ps3netsrv.nix
./snapraid.nix ./snapraid.nix
./taskserver.nix ./taskserver.nix
./udpt.nix
./umts.nix ./umts.nix
./deluge.nix
]; ];
} }

57
makefu/3modules/udpt.nix Normal file
View File

@ -0,0 +1,57 @@
{ config, lib, pkgs, ... }:
with config.krebs.lib;
let
cfg = config.makefu.udpt;
out = {
options.makefu.udpt = api;
config = lib.mkIf cfg.enable imp;
};
api = {
enable = mkEnableOption "udpt";
package = mkOption {
type = types.package;
default = pkgs.udpt;
};
cfgfile = mkOption {
type = types.path;
default = "${cfg.package}/etc/udpt.conf";
};
user = mkOption {
description = ''
user which will run udpt. if kept default a new user will be created
'';
type = types.str;
default = "udpt";
};
};
imp = {
systemd.services.udpt = {
description = "udpt server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
serviceConfig = {
Type = "simple";
ExecStart = "${cfg.package}/bin/udpt -c ${shell.escape cfg.cfgfile}";
PrivateTmp = true;
User = "${cfg.user}";
};
};
users = lib.mkIf (cfg.user == "udpt") {
users.udpt = {
uid = genid "udpt";
};
groups.udpt.gid = genid "udpt";
};
};
in
out