mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
treewide: format all inactive Nix files
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-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 57b193d8dd
result/bin/apply-formatting $NIXPKGS_PATH
This commit is contained in:
parent
57b193d8dd
commit
667d42c00d
21287 changed files with 701385 additions and 428458 deletions
|
@ -1,4 +1,9 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
||||
cfg = config.services.autossh;
|
||||
|
@ -14,43 +19,45 @@ in
|
|||
services.autossh = {
|
||||
|
||||
sessions = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "socks-peer";
|
||||
description = "Name of the local AutoSSH session";
|
||||
type = lib.types.listOf (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "socks-peer";
|
||||
description = "Name of the local AutoSSH session";
|
||||
};
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "bill";
|
||||
description = "Name of the user the AutoSSH session should run as";
|
||||
};
|
||||
monitoringPort = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 0;
|
||||
example = 20000;
|
||||
description = ''
|
||||
Port to be used by AutoSSH for peer monitoring. Note, that
|
||||
AutoSSH also uses mport+1. Value of 0 disables the keep-alive
|
||||
style monitoring
|
||||
'';
|
||||
};
|
||||
extraArguments = lib.mkOption {
|
||||
type = lib.types.separatedString " ";
|
||||
example = "-N -D4343 bill@socks.example.net";
|
||||
description = ''
|
||||
Arguments to be passed to AutoSSH and retransmitted to SSH
|
||||
process. Some meaningful options include -N (don't run remote
|
||||
command), -D (open SOCKS proxy on local port), -R (forward
|
||||
remote port), -L (forward local port), -v (Enable debug). Check
|
||||
ssh manual for the complete list.
|
||||
'';
|
||||
};
|
||||
};
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "bill";
|
||||
description = "Name of the user the AutoSSH session should run as";
|
||||
};
|
||||
monitoringPort = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 0;
|
||||
example = 20000;
|
||||
description = ''
|
||||
Port to be used by AutoSSH for peer monitoring. Note, that
|
||||
AutoSSH also uses mport+1. Value of 0 disables the keep-alive
|
||||
style monitoring
|
||||
'';
|
||||
};
|
||||
extraArguments = lib.mkOption {
|
||||
type = lib.types.separatedString " ";
|
||||
example = "-N -D4343 bill@socks.example.net";
|
||||
description = ''
|
||||
Arguments to be passed to AutoSSH and retransmitted to SSH
|
||||
process. Some meaningful options include -N (don't run remote
|
||||
command), -D (open SOCKS proxy on local port), -R (forward
|
||||
remote port), -L (forward local port), -v (Enable debug). Check
|
||||
ssh manual for the complete list.
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
default = [];
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of AutoSSH sessions to start as systemd services. Each service is
|
||||
named 'autossh-{session.name}'.
|
||||
|
@ -58,10 +65,10 @@ in
|
|||
|
||||
example = [
|
||||
{
|
||||
name="socks-peer";
|
||||
user="bill";
|
||||
name = "socks-peer";
|
||||
user = "bill";
|
||||
monitoringPort = 20000;
|
||||
extraArguments="-N -D4343 billremote@socks.host.net";
|
||||
extraArguments = "-N -D4343 billremote@socks.host.net";
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -72,12 +79,14 @@ in
|
|||
|
||||
###### implementation
|
||||
|
||||
config = lib.mkIf (cfg.sessions != []) {
|
||||
config = lib.mkIf (cfg.sessions != [ ]) {
|
||||
|
||||
systemd.services =
|
||||
|
||||
lib.foldr ( s : acc : acc //
|
||||
{
|
||||
lib.foldr (
|
||||
s: acc:
|
||||
acc
|
||||
// {
|
||||
"autossh-${s.name}" =
|
||||
let
|
||||
mport = if s ? monitoringPort then s.monitoringPort else 0;
|
||||
|
@ -89,20 +98,21 @@ in
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
# To be able to start the service with no network connection
|
||||
environment.AUTOSSH_GATETIME="0";
|
||||
environment.AUTOSSH_GATETIME = "0";
|
||||
|
||||
# How often AutoSSH checks the network, in seconds
|
||||
environment.AUTOSSH_POLL="30";
|
||||
environment.AUTOSSH_POLL = "30";
|
||||
|
||||
serviceConfig = {
|
||||
User = "${s.user}";
|
||||
# AutoSSH may exit with 0 code if the SSH session was
|
||||
# gracefully terminated by either local or remote side.
|
||||
Restart = "on-success";
|
||||
ExecStart = "${pkgs.autossh}/bin/autossh -M ${toString mport} ${s.extraArguments}";
|
||||
User = "${s.user}";
|
||||
# AutoSSH may exit with 0 code if the SSH session was
|
||||
# gracefully terminated by either local or remote side.
|
||||
Restart = "on-success";
|
||||
ExecStart = "${pkgs.autossh}/bin/autossh -M ${toString mport} ${s.extraArguments}";
|
||||
};
|
||||
};
|
||||
}) {} cfg.sessions;
|
||||
}
|
||||
) { } cfg.sessions;
|
||||
|
||||
environment.systemPackages = [ pkgs.autossh ];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue