mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 14:26:33 +01:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
59 lines
1.4 KiB
Nix
59 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
###### interface
|
|
|
|
options = {
|
|
services.tinydns = {
|
|
enable = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = "Whether to run the tinydns dns server";
|
|
};
|
|
|
|
data = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = "The DNS data to serve, in the format described by tinydns-data(8)";
|
|
};
|
|
|
|
ip = mkOption {
|
|
default = "0.0.0.0";
|
|
type = types.str;
|
|
description = "IP address on which to listen for connections";
|
|
};
|
|
};
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = mkIf config.services.tinydns.enable {
|
|
environment.systemPackages = [ pkgs.djbdns ];
|
|
|
|
users.users.tinydns = {
|
|
isSystemUser = true;
|
|
group = "tinydns";
|
|
};
|
|
users.groups.tinydns = {};
|
|
|
|
systemd.services.tinydns = {
|
|
description = "djbdns tinydns server";
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" ];
|
|
path = with pkgs; [ daemontools djbdns ];
|
|
preStart = ''
|
|
rm -rf /var/lib/tinydns
|
|
tinydns-conf tinydns tinydns /var/lib/tinydns ${config.services.tinydns.ip}
|
|
cd /var/lib/tinydns/root/
|
|
ln -sf ${pkgs.writeText "tinydns-data" config.services.tinydns.data} data
|
|
tinydns-data
|
|
'';
|
|
script = ''
|
|
cd /var/lib/tinydns
|
|
exec ./run
|
|
'';
|
|
};
|
|
};
|
|
}
|