mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-03 12:23:02 +00: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.
60 lines
1.2 KiB
Nix
60 lines
1.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.services.fakeroute;
|
|
routeConf = pkgs.writeText "route.conf" (lib.concatStringsSep "\n" cfg.route);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.fakeroute = {
|
|
|
|
enable = lib.mkEnableOption "the fakeroute service";
|
|
|
|
route = lib.mkOption {
|
|
type = with lib.types; listOf str;
|
|
default = [];
|
|
example = [
|
|
"216.102.187.130"
|
|
"4.0.1.122"
|
|
"198.116.142.34"
|
|
"63.199.8.242"
|
|
];
|
|
description = ''
|
|
Fake route that will appear after the real
|
|
one to any host running a traceroute.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
###### implementation
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
systemd.services.fakeroute = {
|
|
description = "Fakeroute Daemon";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
Type = "forking";
|
|
User = "fakeroute";
|
|
DynamicUser = true;
|
|
AmbientCapabilities = [ "CAP_NET_RAW" ];
|
|
ExecStart = "${pkgs.fakeroute}/bin/fakeroute -f ${routeConf}";
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
meta.maintainers = with lib.maintainers; [ rnhmjoj ];
|
|
|
|
}
|