mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-22 01:11:02 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
94 lines
1.9 KiB
Nix
94 lines
1.9 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.services.pdnsd;
|
|
pdnsd = pkgs.pdnsd;
|
|
pdnsdUser = "pdnsd";
|
|
pdnsdGroup = "pdnsd";
|
|
pdnsdConf = pkgs.writeText "pdnsd.conf" ''
|
|
global {
|
|
run_as=${pdnsdUser};
|
|
cache_dir="${cfg.cacheDir}";
|
|
${cfg.globalConfig}
|
|
}
|
|
|
|
server {
|
|
${cfg.serverConfig}
|
|
}
|
|
${cfg.extraConfig}
|
|
'';
|
|
in
|
|
|
|
{
|
|
options = {
|
|
services.pdnsd = {
|
|
enable = mkEnableOption "pdnsd";
|
|
|
|
cacheDir = mkOption {
|
|
type = types.str;
|
|
default = "/var/cache/pdnsd";
|
|
description = "Directory holding the pdnsd cache";
|
|
};
|
|
|
|
globalConfig = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = ''
|
|
Global configuration that should be added to the global directory
|
|
of `pdnsd.conf`.
|
|
'';
|
|
};
|
|
|
|
serverConfig = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = ''
|
|
Server configuration that should be added to the server directory
|
|
of `pdnsd.conf`.
|
|
'';
|
|
};
|
|
|
|
extraConfig = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = ''
|
|
Extra configuration directives that should be added to
|
|
`pdnsd.conf`.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
users.users.${pdnsdUser} = {
|
|
uid = config.ids.uids.pdnsd;
|
|
group = pdnsdGroup;
|
|
description = "pdnsd user";
|
|
};
|
|
|
|
users.groups.${pdnsdGroup} = {
|
|
gid = config.ids.gids.pdnsd;
|
|
};
|
|
|
|
systemd.services.pdnsd = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" ];
|
|
preStart = ''
|
|
mkdir -p "${cfg.cacheDir}"
|
|
touch "${cfg.cacheDir}/pdnsd.cache"
|
|
chown -R ${pdnsdUser}:${pdnsdGroup} "${cfg.cacheDir}"
|
|
'';
|
|
description = "pdnsd";
|
|
serviceConfig = {
|
|
ExecStart = "${pdnsd}/bin/pdnsd -c ${pdnsdConf}";
|
|
};
|
|
};
|
|
};
|
|
}
|